Affected files: .obsidian/workspace 03. 專注Study/Android/ADB 取得 APK 的 icon.md 03. 專注Study/Android/ADB.md 03. 專注Study/Android/AOSP.md 03. 專注Study/Android/Android programming.md 03. 專注Study/Android/AudioTrack.md 03. 專注Study/Android/Ktor.md 03. 專注Study/Android/Service.md 03. 專注Study/Android/Tools.md 03. 專注Study/Android/UI.md 03. 專注Study/C++/C++17.md 03. 專注Study/C++/Class template.md 03. 專注Study/C++/GCC.md 03. 專注Study/C++/Structured binding declaration.md 03. 專注Study/C++/for_each.md 03. 專注Study/C++/lambda.md 03. 專注Study/C++/lvalue.md 03. 專注Study/C++/move operator.md 03. 專注Study/C++/rvalue.md 03. 專注Study/C++/智慧指標.md 03. 專注Study/RxKotlin/20200207 - Study RxKotlin.md 04. Programming/COM/20210726 - COM Interface.md 04. Programming/DB/MySQL.md 04. Programming/DB/sqlite.md 04. Programming/Design Pattern.md 04. Programming/FFMPEG/00. Introduction.md 04. Programming/FFMPEG/01. Setup.md 04. Programming/FFMPEG/FFMpeg.md 04. Programming/Flask.md 04. Programming/Kotlin/class.md 04. Programming/Kotlin/run, let, with, also 和 apply.md 04. Programming/Media Foundation/20210604 - Windows media foundation.md 04. Programming/OpenCV.md 04. Programming/OpenGL.md 04. Programming/Python/argparse.ArgumentParser.md 04. Programming/Python/decorator.md 04. Programming/Python/logging.md 04. Programming/Python/opencv.md 04. Programming/Python/subprocess.md 04. Programming/Python/threading.md 04. Programming/Python/tkinter.md 04. Programming/Python/檢測工具.md 04. Programming/QT/Dropdown button.md 04. Programming/QT/QVariant.md 04. Programming/QT/Qt.md 04. Programming/UML.md 04. Programming/演算法.md 05. 資料收集/99. templates/blogHeader.md 05. 資料收集/99. templates/date.md 05. 資料收集/99. templates/front matter.md 05. 資料收集/99. templates/note.md 05. 資料收集/99. templates/table.md 05. 資料收集/99. templates/thisWeek.md 05. 資料收集/99. templates/日記.md 05. 資料收集/99. templates/讀書筆記.md 05. 資料收集/Linux/CLI/cut.md 05. 資料收集/Linux/CLI/scp.md 05. 資料收集/Linux/CLI/timedatectl.md 05. 資料收集/Linux/Programming.md 05. 資料收集/Linux/Ubuntu.md 05. 資料收集/Tool Setup/Hardware/RaspberryPi.md 05. 資料收集/Tool Setup/Software/Chrome.md 05. 資料收集/Tool Setup/Software/Obisidian.md 05. 資料收集/Tool Setup/Software/SublimeText.md 05. 資料收集/Tool Setup/Software/VirtualBox.md 05. 資料收集/Tool Setup/Software/Visual Studio Code.md 05. 資料收集/Tool Setup/Software/Windows Setup.md 05. 資料收集/Tool Setup/Software/Windows Terminal.md 05. 資料收集/Tool Setup/Software/freefilesync.md 05. 資料收集/Tool Setup/Software/vim.md 05. 資料收集/名言佳句.md 05. 資料收集/架站/Gitea.md 05. 資料收集/架站/HTTP Server/Apache.md 05. 資料收集/架站/HTTP Server/Nginx/Reverse Proxy(Layer4).md 05. 資料收集/架站/Pelican blog.md 05. 資料收集/架站/Proxmox VE.md 05. 資料收集/架站/SWAG Reverse proxy.md 05. 資料收集/架站/Storj.md 05. 資料收集/架站/Trojan.md 05. 資料收集/每週外食.md 05. 資料收集/科技/802.11.md 05. 資料收集/科技/HDR Sensor.md 05. 資料收集/科技/量子電腦.md 05. 資料收集/科技/鋰電池.md 05. 資料收集/興趣嗜好/RC/Traxxas Sledge.md 05. 資料收集/興趣嗜好/RC/好盈電變調整中立點.md 05. 資料收集/興趣嗜好/RC/差速器調教教學.md 05. 資料收集/興趣嗜好/模型/舊化作例.md 05. 資料收集/興趣嗜好/軍武/虎式.md 05. 資料收集/讀書筆記/20201201 - 學習如何學習.md 05. 資料收集/讀書筆記/20201218 - Kotlin權威2.0.md 05. 資料收集/讀書筆記/20201224 - 寫作是最好的自我投資.md 05. 資料收集/讀書筆記/20210119 - 中產悲歌.md 05. 資料收集/讀書筆記/20210220 - 最高學習法.md 05. 資料收集/讀書筆記/20210320 - 最高學以致用法.md 05. 資料收集/讀書筆記/20210406 - 精準購買.md 05. 資料收集/讀書筆記/20210723 - 高手學習.md 05. 資料收集/讀書筆記/20220526 - 深入淺出設計模式.md 05. 資料收集/讀書筆記/20220619 - 精確的力量.md 05. 資料收集/軟體工具/IPFS.md 05. 資料收集/軟體工具/MkDocs.md 05. 資料收集/軟體工具/Obsidian.md 05. 資料收集/軟體工具/docker.md 05. 資料收集/軟體工具/git/apply.md 05. 資料收集/軟體工具/git/submodule.md 05. 資料收集/軟體工具/youtube-dl.md 05. 資料收集/面試準備/技术面试最后反问面试官的话.md
328 lines
10 KiB
Markdown
328 lines
10 KiB
Markdown
# 快速鍵
|
||
## 顯示快速鍵列表
|
||
- 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"
|
||
},
|
||
}
|
||
|
||
``` |