vault backup: 2022-09-28 19:13:41

Affected files:
.obsidian/workspace
03. Programming/COM/20210726 - COM Interface.md
03. Programming/DB/MySQL.md
03. Programming/DB/sqlite.md
03. Programming/Design Pattern.md
03. Programming/FFMPEG/00. Introduction.md
03. Programming/FFMPEG/01. Setup.md
03. Programming/FFMPEG/FFMpeg.md
03. Programming/Flask.md
03. Programming/Media Foundation/20210604 - Windows media foundation.md
03. Programming/OpenCV.md
03. Programming/OpenGL.md
03. Programming/Python/argparse.ArgumentParser.md
03. Programming/Python/decorator.md
03. Programming/Python/logging.md
03. Programming/Python/opencv.md
03. Programming/Python/subprocess.md
03. Programming/Python/threading.md
03. Programming/Python/tkinter.md
03. Programming/Python/檢測工具.md
03. Programming/QT/Dropdown button.md
03. Programming/QT/QVariant.md
03. Programming/QT/Qt.md
03. Programming/UML.md
03. Programming/演算法.md
04. 資料收集/99. templates/blogHeader.md
04. 資料收集/99. templates/date.md
04. 資料收集/99. templates/front matter.md
04. 資料收集/99. templates/note.md
04. 資料收集/99. templates/table.md
04. 資料收集/99. templates/thisWeek.md
04. 資料收集/99. templates/日記.md
04. 資料收集/99. templates/讀書筆記.md
04. 資料收集/Linux/CLI/cut.md
04. 資料收集/Linux/CLI/scp.md
04. 資料收集/Linux/CLI/timedatectl.md
04. 資料收集/Linux/Programming.md
04. 資料收集/Linux/Ubuntu.md
04. 資料收集/Tool Setup/Hardware/RaspberryPi.md
04. 資料收集/Tool Setup/Software/Chrome.md
04. 資料收集/Tool Setup/Software/Obisidian.md
04. 資料收集/Tool Setup/Software/SublimeText.md
04. 資料收集/Tool Setup/Software/VirtualBox.md
04. 資料收集/Tool Setup/Software/Visual Studio Code.md
04. 資料收集/Tool Setup/Software/Windows Setup.md
04. 資料收集/Tool Setup/Software/Windows Terminal.md
04. 資料收集/Tool Setup/Software/freefilesync.md
04. 資料收集/Tool Setup/Software/vim.md
04. 資料收集/名言佳句.md
04. 資料收集/架站/Gitea.md
04. 資料收集/架站/HTTP Server/Apache.md
04. 資料收集/架站/HTTP Server/Nginx/Reverse Proxy(Layer4).md
04. 資料收集/架站/Pelican blog.md
04. 資料收集/架站/Proxmox VE.md
04. 資料收集/架站/SWAG Reverse proxy.md
04. 資料收集/架站/Storj.md
04. 資料收集/架站/Trojan.md
04. 資料收集/每週外食.md
04. 資料收集/科技/802.11.md
04. 資料收集/科技/HDR Sensor.md
04. 資料收集/科技/量子電腦.md
04. 資料收集/科技/鋰電池.md
04. 資料收集/興趣嗜好/RC/Traxxas Sledge.md
04. 資料收集/興趣嗜好/RC/好盈電變調整中立點.md
04. 資料收集/興趣嗜好/RC/差速器調教教學.md
04. 資料收集/興趣嗜好/模型/舊化作例.md
04. 資料收集/興趣嗜好/軍武/虎式.md
04. 資料收集/讀書筆記/20201201 - 學習如何學習.md
04. 資料收集/讀書筆記/20201218 - Kotlin權威2.0.md
04. 資料收集/讀書筆記/20201224 - 寫作是最好的自我投資.md
04. 資料收集/讀書筆記/20210119 - 中產悲歌.md
04. 資料收集/讀書筆記/20210220 - 最高學習法.md
04. 資料收集/讀書筆記/20210320 - 最高學以致用法.md
04. 資料收集/讀書筆記/20210406 - 精準購買.md
04. 資料收集/讀書筆記/20210723 - 高手學習.md
04. 資料收集/讀書筆記/20220526 - 深入淺出設計模式.md
04. 資料收集/讀書筆記/20220619 - 精確的力量.md
04. 資料收集/軟體工具/IPFS.md
04. 資料收集/軟體工具/MkDocs.md
04. 資料收集/軟體工具/Obsidian.md
04. 資料收集/軟體工具/docker.md
04. 資料收集/軟體工具/git/apply.md
04. 資料收集/軟體工具/git/submodule.md
04. 資料收集/軟體工具/youtube-dl.md
04. 資料收集/面試準備/技术面试最后反问面试官的话.md
This commit is contained in:
2022-09-28 19:13:41 +08:00
parent 0534f846d1
commit c847c7f07d
85 changed files with 7 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
## Cache to Ramdisk
1. 關閉 Chrome
2. 開啟檔案總管至以下路徑:`%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default`
3. 刪除 Cache 資料夾
4. 用管理員權限開啟 cmd
5. 輸入以下指令以建立 Symbolic Link: `mklink /d "%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Cache\" "R:\TEMP\Chrome\"`
6. (Optional) 如果有多個使用者的話: `mklink /d "%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Profile 1\Cache\" "R:\TEMP\Chrome\"`
## 網站黑名單
- 用[uBlacklist](https://chrome.google.com/webstore/detail/ublacklist/pncfbmialoiaghdehhbnbhkkgmjanfhe)來阻擋不想要的網站
- uBlacklist 也可以設定黑名單,推薦黑名單:
- [danny0838/content-farm-terminator at gh-pages](https://github.com/danny0838/content-farm-terminator/tree/gh-pages)
- [標準內容農場清單](https://danny0838.github.io/content-farm-terminator/files/blocklist/content-farms.txt)
- [類內容農場清單](https://danny0838.github.io/content-farm-terminator/files/blocklist/nearly-content-farms.txt)
- [社群內容農場清單](https://danny0838.github.io/content-farm-terminator/files/blocklist/sns-content-farms.txt)
- [假新聞網站清單](https://danny0838.github.io/content-farm-terminator/files/blocklist/fake-news.txt)
- [詐騙網站清單](https://danny0838.github.io/content-farm-terminator/files/blocklist/scam-sites.txt)
- [cobaltdisco/Google-Chinese-Results-Blocklist: 我终于能用谷歌搜中文了……](https://github.com/cobaltdisco/Google-Chinese-Results-Blocklist)
- [中文搜索结果黑名单](https://raw.githubusercontent.com/cobaltdisco/Google-Chinese-Results-Blocklist/master/uBlacklist_subscription.txt)
### 參考
- [效率封殺 Google 搜尋裡面的垃圾結果與內容農場 | jkgtw's blog ](https://www.jkg.tw/p3525/)

View File

@@ -0,0 +1,275 @@
---
tags:
aliases:
date: 2022-05-26
time: 14:51:12
description:
---
## YAML front matter
官方說明:[YAML front matter - Obsidian Help](https://help.obsidian.md/Advanced+topics/YAML+front+matter)
目前使用的front matter是[[front matter]]。
## 自動產生時間日期
Obsidian在抽入template的時候可以使用`{{date}}`來表示日期,用`{{time}}`來表示時間。
### `{{date}}` & `{{time}}`
`{{date}}`產生的時間格式為`2022-05-26`可以使用參數來更改格式例如不要讓月份與日期自動補0可以用`{{date:YYYY-M-D}}`
時間也一樣,`{{time}}`產生的格式為`14:48:45`,也有其他參數來變更格式,其他更詳細參考[Moment.js | Docs](https://momentjs.com/docs/#/displaying/)。
## Customize CSS
路徑是`<valut_name>\.obsidian\snippets\obsidian.css`
Obsidian預設定義了很多CSS class只要更改這些class就可以定義自己喜歡的外觀。
- [Obsidian自定义样式修改教程 - 知乎](https://zhuanlan.zhihu.com/p/373888121)
- [obsidian-css-snippets](https://github.com/Dmytro-Shulha/obsidian-css-snippets/tree/master/Snippets)
- [使用 CSS 代码片段增强 Obsidian 视觉效果(一) | ReadingHere](https://www.readinghere.com/blog/using-css-snippets-to-enhance-obsidian-visuals-cn/)
## My CSS
The CSS content:
```css
/*************************************************************
* Headers
*/
.cm-header-1, .markdown-preview-section h1 {
color: #081f37;
}
.cm-header-2, .markdown-preview-section h2 {
color: #1e549f;
}
.cm-header-3, .markdown-preview-section h3 {
color: #2e79ba;
}
.cm-header-4, .markdown-preview-section h4 {
color: #5fc9f3;
}
.cm-header-5, .markdown-preview-section h5 {
color: #415865;
}
.cm-header-6, .markdown-preview-section h6 {
color: #7a9eb1;
}
/*************************************************************
* List
*/
.cm-list-1 {
font-family: Cascadia Code;
}
.cm-list-2 {
font-family: Cascadia Code;
}
.cm-list-3 {
font-family: Cascadia Code;
}
.cm-list-4 {
font-family: Cascadia Code;
}
.cm-list-5 {
font-family: Cascadia Code;
}
span.cm-formatting-list-ul {
visibility: hidden !important;
}
span.cm-formatting-list-ul:after {
content: '• '; /* ITS theme; for Blue Topaz */
margin-left: -12px;
color: var(--accent); /* ITS theme; for Blue Topaz --text-normal */
visibility: visible !important;
}
ol {
font-family: Cascadia Code;
padding-inline-start: 2.5rem;
}
ul {
font-family: Cascadia Code;
padding-inline-start: 2.4rem;
list-style-type: disc;
}
/*Make list marker to be a circle*/
input[type="checkbox"],
.cm-formatting-task {
-webkit-appearance: none;
appearance: none;
border-radius: 50%;
border: 1px solid var(--text-faint);
padding: 0;
vertical-align: middle;
}
.cm-s-obsidian span.cm-formatting-task {
color: transparent;
width: 1.1em !important;
height: 1.1em;
display: inline-block;
}
input[type="checkbox"]:focus {
outline: 0;
}
input[type="checkbox"]:checked,
.cm-formatting-task.cm-property {
background-color: var(--text-accent-hover);
border: 1px solid var(--text-accent-hover);
background-position: center;
background-size: 60%;
background-repeat: no-repeat;
background-image: url('data:image/svg+xml; utf8, <svg width="12px" height="10px" viewBox="0 0 12 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-4.000000, -6.000000)" fill="%23ffffff"><path d="M8.1043257,14.0367999 L4.52468714,10.5420499 C4.32525014,10.3497722 4.32525014,10.0368095 4.52468714,9.8424863 L5.24777413,9.1439454 C5.44721114,8.95166768 5.77142411,8.95166768 5.97086112,9.1439454 L8.46638057,11.5903727 L14.0291389,6.1442083 C14.2285759,5.95193057 14.5527889,5.95193057 14.7522259,6.1442083 L15.4753129,6.84377194 C15.6747499,7.03604967 15.6747499,7.35003511 15.4753129,7.54129009 L8.82741268,14.0367999 C8.62797568,14.2290777 8.3037627,14.2290777 8.1043257,14.0367999"></path></g></g></svg>');
}
/*************************************************************
* External link & Internal link
*/
.cm-s-obsidian span.cm-link,
.cm-s-obsidian span.cm-url,
.cm-s-obsidian span.cm-hmd-internal-link {
color: #0000EE;
font-family: Cascadia Code;
}
a.external-link {
color: #0000EE;
font-family: Cascadia Code;
}
/*************************************************************
* Outline
*/
.outline {
font-size: 0.8rem;
font-weight: 200;
}
.outline .tree-item {
line-height: 1.3;
}
.outline .tree-item-self {
padding-top: 0.2rem;
padding-bottom: 0.1rem;
padding-left: 0.5rem;
padding-right: 0.3rem;
}
.outline .tree-item-collapse {
left: 0.1rem;
}
.outline .tree-item-inner{
position:relative;
padding-top: 0.2rem;
/* padding-left: 1rem; */
padding-left: 1.7em;
text-indent: -0.8em;
margin-left: 0.2rem;
/* font-size: 0.9em; */
}
.outline .tree-item-children {
margin-left: 0.7rem;
padding-left: 0.5rem;
margin-top: -0.3rem;
padding-top: 0.3rem;
border-left: 1px solid var(--sidebar-marks, var(--background-modifier-border));
border-radius: 4px;
transition:all 0.5s ease-in-out;
}
.outline .tree-item-children:hover {
border-left-color: var(--sidebar-marks-hover, var(--background-secondary));
}
.outline .collapse-icon + .tree-item-inner {
font-weight: 400;
padding-left: 0.2rem;
/* margin-left: 0rem; */
/* font-size: 1em; */
}
.outline .collapse-icon {
margin-top: 0.2rem;
margin-left: -0.4rem;
margin-right: -0.4rem;
width: 2rem;
}
/*************************************************************
* Sidebar
*/
/*Vault name*/
.nav-folder.mod-root > .nav-folder-title {
padding-left: 6px;
font-size: 14px;
font-weight: bolder;
top: -6px; /* higher */
cursor: default;
color: var(--base2);
}
.nav-folder-title,
.nav-file-title {
font-size: 0.8em;
font-family: consolas;
line-height: 0.8em;
}
.nav-folder-title {
font-weight: bold;
color: #132743;
}
.nav-file-title {
color: #407088;
}
.nav-folder,
.nav-file {
margin: 0 !important;
border-left: 1px solid rgba(118, 158, 165, 0.2);
}
.cm-quote {
line-height: 1.2em;
/*font-style: italic;*/
}
/*************************************************************
* Quote
*/
.cm-formatting-quote:before {
margin-right: -0.1em;
color: var(--color-10) !important;
font-family: "ico";
content: "\edd5";
}
/*************************************************************
* Code block(inline)
*/
.cm-s-obsidian span.cm-inline-code {
/*font-size: 1em;*/
}
```
## 參考
- [使用 CSS 代码片段增强 Obsidian 视觉效果(一) | ReadingHere](https://www.readinghere.com/blog/using-css-snippets-to-enhance-obsidian-visuals-cn/)
- [obsidian-css-snippets](https://github.com/Dmytro-Shulha/obsidian-css-snippets/tree/master/Snippets)
- [Obsidian自定义样式修改教程 - 知乎](https://zhuanlan.zhihu.com/p/373888121)
- [Day 26 : 插件篇 05 — 做好筆記備份,使用 Obsidian Git自動備份筆記到 Github - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天](https://ithelp.ithome.com.tw/articles/10280373)

View File

@@ -0,0 +1,24 @@
```json
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by syntax-specific settings.
{
"close_windows_when_empty": true,
"draw_indent_guides": false,
"font_face": "Fira Code",
"font_size": 11,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"show_full_path": true,
"show_tab_close_buttons": false,
"spell_check": false,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"use_tab_stops": true,
"draw_white_space": "all",
"trim_trailing_white_space_on_save": true,
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"
}
```

View File

@@ -0,0 +1,6 @@
## 讓Virtualbox與Hyper-V並存
用Administrator打開Powershell輸入以下指令
```
cd "C:\Program Files\Oracle\VirtualBox"
./VBoxManage.exe setextradata global "VBoxInternal/NEM/UseRing0Runloop" 0
```

View File

@@ -0,0 +1,328 @@
# 快速鍵
## 顯示快速鍵列表
- Windows: `Ctrl + k` + `Ctrl + s`
- Mac: `⌘ + k` + `⌘ + s`
## 分割目前視窗
- Windows: `Ctrl + \`
- Mac: `⌘ + \`
## 程式格式化
### 格式化整個文件
`Shift + Alf + f`
### 格式化選取的範圍
`Ctrl + k` + `Ctrl + f`
### setting.json
- `"editor.formatOnType": true`:輸入一行後,自動格式化目前這一行。
- `"editor.formatOnSave": true`:儲存時格式化檔案。
- `"editor.formatOnPaste": true`:貼上程式碼時格式化貼上的內容。
```json
{
"python.terminal.activateEnvironment": true, // 自動啟動環境
"python.linting.pylintEnabled": true, // 需要 pip install pylint
"python.linting.enabled": true,
"python.autoComplete.addBrackets": true, // 自動為自動完成的function加上括號
"python.languageServer": "Pylance",
"python.analysis.completeFunctionParens": true,
"jupyter.sendSelectionToInteractiveWindow": true,
"jupyter.interactiveWindowMode": "perFile",
"terminal.integrated.fontFamily": "Fira Code", // For Windows
"terminal.integrated.profiles.windows": {
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
},
"PowerShell -NoProfile": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"terminal.integrated.cwd": "${fileDirname}",
// "editor.fontFamily": "Cascadia code Light",
// "editor.fontFamily": "PragmataPro Liga",
// "editor.fontFamily": "Fira Code Retina",
"editor.fontFamily": "Iosevka Expanded",
// "editor.fontFamily": "Hasklig Light",
"editor.fontSize": 14,
"editor.fontLigatures": true,
"editor.fontWeight": "normal",
"editor.minimap.renderCharacters": false,
"editor.renderWhitespace": "boundary",
"editor.renderIndentGuides": false,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.bracketPairColorization.enabled": true,
"outline.showVariables": false,
"sync.gist": "aaee0ee8733879ef2da2eb1b4bf8a993",
"sync.quietSync": false,
"sync.removeExtensions": true,
"sync.syncExtensions": true,
"sync.autoDownload": false,
"sync.autoUpload": false,
"sync.forceDownload": false,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"explorer.confirmDelete": false,
"workbench.colorTheme": "One Dark Pro",
"workbench.iconTheme": "material-icon-theme",
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"oneDarkPro.vivid": true,
"gitlens.advanced.messages": {
"suppressImproperWorkspaceCasingWarning": true
},
"workbench.colorCustomizations": {
"editor.lineHighlightBackground": "#1073cf2d",
"editor.lineHighlightBorder": "#9fced11f"
},
"editor.wordWrap": "off",
"diffEditor.wordWrap": "off",
"editor.guides.indentation": false,
"editor.guides.bracketPairs": false,
}
```
## 折疊程式碼
### 收起目前區塊
- Windows: `Ctrl + Shift + [`
- Mac: `⌥ + ⌘ + [`
### 打開目前區塊
- Windows: `Ctrl + Shift + ]`
- Mac: `⌥ + ⌘ + ]`
### 收起目前區塊(整個檔案)
- Windows: `Ctrl + (K => 0) (zero)`
- Mac: `⌘ + (K => 0) (zero)`
### 打開目前區塊(整個檔案)
- Windows: `Ctrl + (K => J) `
- Mac: `⌘ + (K => J)`
## 在「已開啟的檔案」間跳轉
`Ctrl + tab`
# Plugin
## Setting Sync
- 參考:[https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync)
~~- GIST Token: `e0f7c5233e3c6dafee77047f61ea74f0d01d24e1`~~
- GIST Token: `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`
- GIST ID: [`aaee0ee8733879ef2da2eb1b4bf8a993`](https://gist.github.com/AwinHuang/aaee0ee8733879ef2da2eb1b4bf8a993)
- GIST address: [https://gist.github.com/AwinHuang/aaee0ee8733879ef2da2eb1b4bf8a993](https://gist.github.com/AwinHuang/aaee0ee8733879ef2da2eb1b4bf8a993)
# Code snippets
## html.json
```json
{
"HTML template": {
"prefix": "HTML_template",
"body": [
"<!doctype html>",
"",
"<html lang=\"en\">",
"<head>",
" <meta charset=\"utf-8\">",
" <meta name=\"description\" content=\"Awin's HTML template\">",
" <meta name=\"author\" content=\"Awin Huang\">",
" <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js\"></script>",
" <title>A HTML template</title>",
"</head>",
"",
"<body>",
" <H1>Awin's HTML template</H1>",
" <p>Click to hide</p>",
"</body>",
"</html>",
"",
"<script>",
" $(document).ready(function(){",
" $(\"p\").click(function(){",
" $(this).hide();",
" });",
" });",
"</script>",
],
"description": "HTML template"
}
}
```
## python.json
```json
{
"Python template": {
"prefix": "Python_Template",
"body": [
"import sys",
"import argparse",
"",
"",
"def main(args=None):",
" ${1:pass}",
"",
"",
"if __name__ == '__main__':",
" parser = argparse.ArgumentParser()",
" parser.add_argument(\"first_file\", help=\"The first file\")",
" parser.add_argument(\"-s\", \"--sample_args\", default=\"sample_args\", help=\"Modify this arguments for you\")",
" args = parser.parse_args()",
" main(args)",
" sys.exit(0)"
],
"description": "Python script template"
},
"F Print": {
"prefix": "f-print",
"body": [
"print(f'$1 = {$1}')"
],
"description": "print() with f-string and default {}"
},
"Q Print": {
"prefix": "q-print",
"body": [
"print('$1 = {}, '.format($1))"
],
"description": "print() with f-string and default {}"
},
"Debug RobotRun": {
"prefix": "debug_robotrun",
"body": [
"import os",
"import sys",
"sys.path.insert(0, 'D:/codes/logitech/')",
"import RobotRun",
"print('+------------------------------------------------------------------------------+')",
"print('| |')",
"print('| RobotRun: {}'.format(RobotRun.__file__))",
"print('| |')",
"print('+------------------------------------------------------------------------------+')",
],
"description": "Change RobotRun to local version"
},
"Flask template": {
"prefix": "Flask_Template",
"body": [
"## Flask template",
"## Author: Awin Huang",
"## Date: 2020/04/09",
"",
"import os, sys",
"import datetime",
"import json",
"from flask import Flask, render_template, request",
"",
"",
"app = Flask(__name__)",
"",
"## Setup log",
"handler = logging.FileHandler('flask.log', delay=False)",
"handler.setLevel(logging.INFO)",
"app.logger.addHandler(handler)",
"app.logger.setLevel(logging.INFO)",
"",
"",
"def info_log(msg):",
" app.logger.info(msg)",
" # print(msg)",
"",
"",
"def error_log(msg):",
" app.logger.error(msg)",
"",
"",
"@app.route('/')",
"def index():",
" info_log('Return main page to user.')",
" return 'Hello, this is main page'",
"",
"",
"## Receive a GET request",
"@app.route('/get_get', methods=['GET'])",
"def run_testcase():",
" command = request.args.get('command')",
" value = 'This is value for GET'",
" return {",
" 'command': command,",
" 'value': value",
" }",
"",
"",
"## Receive a POST request",
"@app.route('/get_post', methods=['POST'])",
"def get_post():",
" command = request.form['command']",
" value = 'This is value for POST'",
" return {",
" 'command': command:",
" 'value': value",
" }",
"",
"",
"if __name__ == '__main__':",
" app.debug = True",
" app.run(host='0.0.0.0')",
],
"description": "Flask template"
},
"Datetime now": {
"prefix": "now_dt",
"body": [
"datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S:%f')"
],
"description": "Get datetime.now() with format '%Y-%m-%d %H:%M:%S:%f'"
},
"Run process": {
"prefix": "runprocess",
"body": [
"import multiprocessing as mp",
"",
"process = mp.Process(target=task_set.run, args=(self.task_sync, args))",
"process.start()",
"process.join()"
],
"description": "Run function in a process"
},
"Sleep with dots": {
"prefix": "sleepdots",
"body": [
"for i in range($1):",
" import time",
" print(\".\", end=\"\", flush=True)",
" time.sleep(1)",
],
"description": "Sleep and print \".\" every second"
},
"Sleep with numbers": {
"prefix": "sleepnum",
"body": [
"for i in range($1):",
" print(f\"{i+1} \", end=\"\", flush=True)",
" time.sleep(1)",
],
"description": "Sleep and print number every second"
},
}
```

View File

@@ -0,0 +1,166 @@
### Install tools
#### 先安裝
- 手動安裝[Google Drive](https://www.google.com/drive/download/),以取得本檔案。
#### 自動安裝
1. 安裝[Chocolatey](https://chocolatey.org/)用Administrator身份打開powershell輸入下列指令
```
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
```
2. 用安裝常用的工具
```
choco install 7zip adobereader vscode hxd sublimetext4 microsoft-windows-terminal androidstudio intellijidea-community git winmerge freefilesync freedownloadmanager gsudo firacode cascadiacode sourcecodepro delta --yes
```
列表:
- 7zip
- adobereader
- vscode
- hxd
- [sublimetext4](https://community.chocolatey.org/packages/sublimetext4/4.0.0.412100)
- microsoft-windows-terminal
- androidstudio
- [intellijidea-community](https://chocolatey.org/packages/intellijidea-community)
- git
- winmerge
- [freefilesync](https://chocolatey.org/packages/freefilesync)
- [freedownloadmanager](https://chocolatey.org/packages/FreeDownloadManager)
- [gsudo](https://community.chocolatey.org/packages/gsudo)
- [firacode](https://community.chocolatey.org/packages/FiraCode)
- [cascadiacode](https://community.chocolatey.org/packages/cascadiacode)
- [sourcecodepro](https://community.chocolatey.org/packages/SourceCodePro)
- [delta](https://community.chocolatey.org/packages/delta)
移除:
- [TeraCopy](https://chocolatey.org/packages/TeraCopy)
- googlechrome
- make
#### 手動安裝
1. Google drive
2. Google drive(Logitech)
3. Python 3.6.3
4. Python 3.9
6. Visual Studio 2017
7. Visual Studio 2019
8. Office 365
9. Lightroom
10. [Enpass](https://www.enpass.io/)
11. [ShareX](https://getsharex.com/)
12. [win32diskimager](https://sourceforge.net/projects/win32diskimager/)
13. [卡巴斯基](https://www.kaspersky.com.tw/)
#### Portable App
1. Aegisub portable
2. Audacity 2.3.3
3. Cheat Engine 7.0
4. cmder v1.3.12
5. ConEmu
6. ConvertZZ.1.0.0.3
7. CrystalDiskMark 6.0.1 x64
8. EzMeta
9. ffmpeg-2020-09-20-full_build
10. FileZillaPortable
11. Geek Uninstaller 1.4.7
12. HxDPortable
13. ImgBurnPortable
14. IntelliJ IDEA
15. JDownloader 2.0
16. PhraseExpress
17. Process Explorer 16.21
18. Q-Dir 9.01
19. Rufus
20. Sandboxie
21. [Speccy](https://www.ccleaner.com/speccy)
22. [ThunderbirdPortable](https://portableapps.com/apps/internet/thunderbird_portable)
23. [WindowGrid 1.3.11](http://windowgrid.net/)
24. [wiztree_3_35_portable](https://wiztreefree.com/download)
### Upgrade
#### Upgrade by Chocolately
```
choco upgrade all -y
```
### Setup
#### Setup doskey in **Command Prompt**
1. 切換到`Document`資料夾。
2. 建立`cmdinit.cmd`,內容如下:
```
@echo off
doskey sl="C:\Program Files\Sublime Text 3\sublime_text.exe"
doskey ll=dir
doskey rrp="cd C:\Python363\lib\site-packages\RobotRun" $T C:
doskey rra=cd "G:\My Drive\codes\Projects\RobotRunApplications" $T G:
doskey gpull=git pull origin master
doskey gpush=git push origin master
doskey gs=git status
doskey gd=git diff
doskey e.=explorer.exe .
```
#### Setup bashrc in **Git bash**
1. 打開`~/.bashrc`
2. 內容如下:
```bash
export PATH="/c/Users/ahuang11/AppData/Local/Android/Sdk/platform-tools:$PATH"
alias adb="/c/EasyAVEngine/Tools/Android/ADB/adb.exe"
alias sl="/c/Program\ Files/Sublime\ Text/subl.exe"
alias fastboot='/c/Users/ahuang11/AppData/Local/Android/Sdk/platform-tools/fastboot.exe'
alias rrp='cd /c/Python363/lib/site-packages/RobotRun'
alias rra='cd /c/RobotRun'
alias rrd='cd /g/My\ Drive/codes/Projects/RobotRunDocs'
alias rro='cd /c/RobotRun/Output'
alias coderrp='cd "/c/Python363/lib/site-packages/RobotRun" ; code "/c/Python363/lib/site-packages/RobotRun"'
alias coderra='cd "/c/RobotRun"; code "/c/RobotRun"'
alias coderras='code "/d/GoogleDriveLogi/codes/Projects/RobotRunAutoServer"'
alias ctest='code "/g/My Drive/codes/test"'
alias ad='adb devices'
alias fd='fastboot devices'
alias e.='explorer.exe .'
##----- Connection -----
alias gods='ssh awin@192.168.1.11'
alias gorp320='ssh pi@192.168.1.20'
##----- Git -----
alias gs="git status"
alias gd="git diff"
alias gpull='git pull origin master'
alias gpush='git push origin master'
alias gpushmain='git push origin main'
alias gc='git clone'
alias gclogi='git clone --config user.name="Awin Huang" --config user.email=ahuang11@logitech.com $@'
##----- Python enviroment swich -----
alias pyv='echo PY_PYTHON=$PY_PYTHON'
function set_py() {
echo "Original Python verison is \"$PY_PYTHON\""
export PY_PYTHON=$1
echo " New Python verison is \"$PY_PYTHON\""
if [ ! -z "$2" ]
then
py "${@:2}"
fi
}
function py36() {
set_py "3.6.3" "$@"
}
function py39() {
set_py "3.9" "$@"
}
```
#### Setup Windows Terminal
1. 開啟Windows Terminal。
2.`ctrl + ,`打開設定,之後參考[[Windows Terminal]]。
#### Setup WSL2
- [[安裝筆記] Windows 10 安裝 Linux 子系統 (WSL2) | Kenmingの鮮思維](http://www.kenming.idv.tw/note_window10_install_wsl2/)
- [[安裝筆記] Windows 10 WSL 2 安裝 Docker Desktop (含更改 Docker Image 路徑) | Kenmingの鮮思維](http://www.kenming.idv.tw/win10_wsl2_install_docker-desktop/)

View File

@@ -0,0 +1,181 @@
## Setup
### New tab as Administrator
- [使用系統管理員身分開啟 Windows Terminal 分頁](https://blog.poychang.net/run-windows-terminal-as-administrator-with-elevated-admin-permissions/)
### Use powerline in Git-Bash
- [Light & simple powerline theme for Git bash for windows](https://github.com/diesire/git_bash_windows_powerline)
#### Install
```shell
cd $HOME
mkdir -p .bash/themes/git_bash_windows_powerline
git clone https://github.com/diesire/git_bash_windows_powerline.git .bash/themes/git_bash_windows_powerline
```
And add following lines to `~/.bashrc`.
```
# Theme
THEME=$HOME/.bash/themes/git_bash_windows_powerline/theme.bash
if [ -f $THEME ]; then
. $THEME
fi
unset THEME
```
參考:
- [powerline/fonts: Patched fonts for Powerline users.](https://github.com/powerline/fonts)
## Settings.json
```json
// This file was initially generated by Windows Terminal 1.6.10571.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
// This file was initially generated by Windows Terminal 1.2.2381.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{00000000-0000-0000-ba54-000000000002}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// Start position
"initialCols": 205,
"initialRows": 30,
"initialPosition": "15,400", // x,y
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
"guid": "{41dd7a51-f0e1-4420-a2ec-1a7130b7e950}",
"name": "Windows PowerShell(Administrator)",
"commandline": "gsudo.exe powershell.exe",
"hidden": false,
"colorScheme": "Solarized Dark",
"fontFace": "Fira Code",
"icon" : "C:\\Users\\awinh\\OneDrive\\圖片\\icon\\console_red.png"
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure",
"hidden": false,
},
{
"guid": "{00000000-0000-0000-ba54-000000000002}",
"name" : "Bash",
"commandline": "%PROGRAMFILES%/git/usr/bin/bash.exe -i -l",
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
"startingDirectory" : "D:\\GoogleDrive\\codes",
"font":
{
"face": "CaskaydiaCove NF",
"size": 12
},
"historySize" : 9000,
},
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [],
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" },
// Full screen
{ "command": "toggleFullscreen", "keys": "alt+x" },
// Open new default tab
{ "command": "newTab", "keys": "ctrl+t" },
// Close current pane
{ "command": "closePane", "keys": "ctrl+w" },
// Split pane in vertical
{ "command": { "action": "splitPane", "split": "vertical"}, "keys": "ctrl+shift+E" },
// Split pane in horizontal
{ "command": { "action": "splitPane", "split": "horizontal"}, "keys": "ctrl+shift+O" },
// Goto next tab
{ "command": "nextTab", "keys": "ctrl+pagedown" },
// Goto previous tab
{ "command": "prevTab", "keys": "ctrl+pageup" },
]
}
```
## oh-my-posh on bash
以下步驟都是在 [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701) 中的 Git bash[^1] 執行。
1. 先下載一個你喜歡的theme: [https://ohmyposh.dev/docs/themes](https://ohmyposh.dev/docs/themes)
2. 下載並安裝字型:[Caskaydia Cove Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CascadiaCode.zip?WT.mc_id=-blog-scottha)
3. Install OhMyPosh: `winget install JanDeDobbeleer.OhMyPosh`
4. 建立並修改 `~/.profile`,然後加入
`eval "$(oh-my-posh --init --shell bash --config ~/OneDrive/appConfigs/ohmyposh/themes/montys.omp.json)"`
注意最後的 `montys.omp.json` 就是第一步下載的theme這邊要改成你自己的路徑。
5. 修改 Windows Terminal 的 setting.json將字型改為 `CaskaydiaCove NF`
![[20220614221618_oh-my-posh_setting.png|600]]
6. 成果
![[20220614220342_oh-my-posh_result.png|600]]
[^1]: 在 [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701) 中設定 Git bash 可以參考:[Windows Terminal's 設定 Git Bash 和 SSH @ 傑克! 真是太神奇了! :: 痞客邦 ::](https://magicjackting.pixnet.net/blog/post/225162505-windows-terminal's-%E8%A8%AD%E5%AE%9A-git-bash-%E5%92%8C-ssh)
## Reference
- [Windows Terminal 美化 for WSL 2 Ubuntu (zsh + zim + powerlevel10k)](http://www.kenming.idv.tw/windows-terminal-%e7%be%8e%e5%8c%96-for-wsl-2-ubuntu-zsh-zim-powerlevel10k/)
- [Oh My Posh](https://ohmyposh.dev/)
- [How to make the ultimate Terminal Prompt on Windows 11 - This video is LONG and WORDY and DETAILED - YouTube](https://www.youtube.com/watch?v=VT2L1SXFq9U)
- [My Ultimate PowerShell prompt with Oh My Posh and the Windows Terminal - Scott Hanselman's Blog](https://www.hanselman.com/blog/my-ultimate-powershell-prompt-with-oh-my-posh-and-the-windows-terminal)
- [Windows-Terminal配置OhMyPosh来美化GitBash_偕臧x的博客-CSDN博客](https://blog.csdn.net/qq_33154343/article/details/120661945)

View File

@@ -0,0 +1,5 @@
1. ![[Pasted image 20210321201359.png]]
2. ![[Pasted image 20210321201503.png]]
參考:
- [FreeFileSync: RealTimeSync - YouTube](https://www.youtube.com/watch?v=9KXo6yOhTWo)

View File

@@ -0,0 +1,27 @@
### `~/.vimrc`
```vim
set t_Co=256
colorscheme koehler
set nocompatible
syntax on
set showmode
set showcmd
set encoding=utf-8
set cindent
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set number
set cursorline
"set textwidth=80
set ruler
set showmatch
set hlsearch
set incsearch
set ignorecase
```