vault backup: 2024-02-17 23:06:48

This commit is contained in:
2024-02-17 23:06:48 +08:00
parent e8b081471f
commit 758fec56e6
29 changed files with 61 additions and 1236 deletions

View File

@@ -8,7 +8,9 @@
{"id":"dd89a32995de8e4a","type":"text","text":"# 參考\n- [Tweak CPU Power Elegantly on Windows - kkocdko's blog](https://kkocdko.site/post/202110041950)\n- [Powersetting.h header - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/powersetting/)","x":460,"y":200,"width":435,"height":180},
{"id":"154d88218d26f035","type":"text","text":"[PowerWriteACValueIndex](https://learn.microsoft.com/en-us/windows/win32/api/powersetting/nf-powersetting-powerwriteacvalueindex)\n```c\nPowerWriteACValueIndex(NULL, scheme, \n &GUID_PROCESSOR_SETTINGS_SUBGROUP,\n &GUID_PROCESSOR_THROTTLE_MAXIMUM, percent);\n```","x":460,"y":-255,"width":429,"height":151},
{"id":"bb0881e617ca2f52","type":"text","text":"[PowerGetActiveScheme](https://learn.microsoft.com/en-us/windows/win32/api/powersetting/nf-powersetting-powergetactivescheme)\n```c\nGUID guid, *scheme = &guid; PowerGetActiveScheme(NULL, &scheme);\n```","x":502,"y":-460,"width":346,"height":125},
{"id":"1b7a2018be9a2542","type":"text","text":"- [[設定CPU Power mode]]","x":80,"y":35,"width":250,"height":60}
{"id":"1b7a2018be9a2542","type":"text","text":"- [[設定CPU Power mode]]","x":80,"y":35,"width":250,"height":60},
{"id":"034536d7a91d7b62","x":-100,"y":320,"width":133,"height":60,"type":"text","text":"工具設定"},
{"id":"197b4dc40754a989","x":-201,"y":460,"width":335,"height":211,"type":"text","text":"- [[Chrome]]\n- [[freefilesync]]\n- [[Obsidian]]\n- [[SublimeText]]\n- [[vim]]\n- [[Visual Studio Code]]\n- [[Windows 11 重灌]]\n- [[Windows Terminal]]"}
],
"edges":[
{"id":"5c4879a42c2db8ac","fromNode":"d34f3157e07cb50d","fromSide":"top","toNode":"0138bfb5c46d71f1","toSide":"bottom"},
@@ -16,6 +18,8 @@
{"id":"f60c6e07e0ef6a98","fromNode":"c276871e8748cbfe","fromSide":"bottom","toNode":"b89cd7d463506018","toSide":"top"},
{"id":"7fada69bb11ae874","fromNode":"154d88218d26f035","fromSide":"bottom","toNode":"c276871e8748cbfe","toSide":"top"},
{"id":"d4c1beba2bea0171","fromNode":"bb0881e617ca2f52","fromSide":"bottom","toNode":"154d88218d26f035","toSide":"top","label":"SchemeGuid"},
{"id":"7000cd2de2280a0a","fromNode":"1b7a2018be9a2542","fromSide":"right","toNode":"e724a0b36766d3a9","toSide":"left"}
{"id":"7000cd2de2280a0a","fromNode":"1b7a2018be9a2542","fromSide":"right","toNode":"e724a0b36766d3a9","toSide":"left"},
{"id":"82d29d89f73fd716","fromNode":"d34f3157e07cb50d","fromSide":"bottom","toNode":"034536d7a91d7b62","toSide":"top"},
{"id":"035012a29ceb315e","fromNode":"034536d7a91d7b62","fromSide":"bottom","toNode":"197b4dc40754a989","toSide":"top"}
]
}

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,304 @@
# 快速鍵
## 顯示快速鍵列表
- 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
{
// 文字編輯器
"editor.bracketPairColorization.enabled": true,
"editor.fontFamily": "Cascadia Code", // 字型
"editor.fontLigatures": true, //啟用連字
"editor.fontSize": 14, // 文字大小
"editor.fontWeight": "normal",
"editor.guides.bracketPairs": false,
"editor.guides.indentation": false,
"editor.insertSpaces": true,
"editor.minimap.renderCharacters": false,
"editor.renderWhitespace": "boundary",
"editor.renderLineHighlight": "all", // 整行高亮
"editor.snippetSuggestions": "top", // 將程式碼片段建議顯示於頂端
"editor.tabCompletion": "on", // 啟用tab鍵自動完成
"editor.tabSize": 4,
"editor.wordWrap": "off",
// 檔案
"files.trimTrailingWhitespace": true, // 儲存檔案時去除行尾空白
"files.insertFinalNewline": true, // 儲存檔案時在結尾插入一個新行
// 檔案管理員
"explorer.confirmDelete": false,
// 工作台
"workbench.colorTheme": "One Dark Pro", // 主題
"workbench.iconTheme": "material-icon-theme", // Icon主題
"workbench.tree.indent": 15,
"workbench.tree.renderIndentGuides": "always",
"workbench.colorCustomizations": {
"tree.indentGuidesStroke": "#05ef3c"
},
"breadcrumbs.enabled": true, // 啟用麵包屑,可以通過上方路徑來資料夾、文件或者是函數的跳轉
"oneDarkPro.vivid": true,
"diffEditor.wordWrap": "off",
// 終端機
"terminal.integrated.fontFamily": "Fira Code",
"editor.accessibilitySupport": "off",
"[python]": {
"editor.formatOnType": true
},
"polacode.target": "snippet",
"editor.inlineSuggest.enabled": true,
"github.copilot.enable": {
"*": true,
"yaml": false,
"plaintext": false,
"markdown": false,
"scminput": 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"
},
}
```
## 參考
- [VSCode 是什么](https://geek-docs.com/vscode/vscode-tutorials/what-is-vscode.html)

View File

@@ -0,0 +1,161 @@
# 要保存/恢復的檔案
- `%userprofile%/.config`
- `%userprofile%/.ssh`
- `%userprofile%/.bash_profile`
- `%userprofile%/.bashrc`
- `%userprofile%/.gitconfig`
- `%userprofile%/.vimrc`
# 安裝工具
## 安裝 Chocolatey
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://community.chocolatey.org/install.ps1'))
```
2. 用安裝常用的工具
```
choco install powertoys 7zip vscode hxd sublimetext4 androidstudio intellijidea-community git winmerge freefilesync freedownloadmanager gsudo firacode cascadiacode sourcecodepro delta googlechrome googledrive enpass.install sharex win32diskimager k-litecodecpackmega obsidian anki enpass.install --yes
```
可以在 [https://community.chocolatey.org/packages](https://community.chocolatey.org/packages) 找到其他工具,再加到清單後面即可。
上面的指令安裝了下列的軟體,可以依自己需求增刪:
- [powertoys](https://community.chocolatey.org/packages/powertoys)
- [7zip](https://community.chocolatey.org/packages/7zip)
- [vscode](https://community.chocolatey.org/packages/vscode)
- [hxd](https://community.chocolatey.org/packages/hxd)
- [sublimetext4](https://community.chocolatey.org/packages/sublimetext4)
- [androidstudio](https://community.chocolatey.org/packages/androidstudio)
- [intellijidea-community](https://community.chocolatey.org/packages/intellijidea-community)
- [git](https://community.chocolatey.org/packages/git)
- [winmerge](https://community.chocolatey.org/packages/winmerge)
- [freefilesync](https://community.chocolatey.org/packages/freefilesync)
- [freedownloadmanager](https://community.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)
- [googlechrome](https://community.chocolatey.org/packages/googlechrome)
- [googledrive](https://community.chocolatey.org/packages/googledrive)
- [enpass.install](https://community.chocolatey.org/packages/enpass.install)
- [sharex](https://community.chocolatey.org/packages/sharex)
- [win32diskimager](https://community.chocolatey.org/packages/win32diskimager)
- [k-litecodecpackmega](https://community.chocolatey.org/packages/k-litecodecpackmega)
- [obsidian](https://community.chocolatey.org/packages/obsidian)
- [anki](https://community.chocolatey.org/packages/anki)
- [Enpass Password Manager](https://community.chocolatey.org/packages/enpass.install)
## 用 Chocolatey 升級軟體
```shell
choco upgrade all -y
```
## 手動安裝
3. Python 3.6.3
4. Python 3.9
7. Visual Studio 2022
8. Office 365
9. Lightroom
11. [ShareX](https://getsharex.com/)
12. [win32diskimager](https://sourceforge.net/projects/win32diskimager/)
13. [卡巴斯基](https://www.kaspersky.com.tw/)
14. 字型
- [Caskaydia](\\diskstation\share\Tools\字型\Caskaydia Cove Nerd Font\)
## `~/.bashrc`
1. 打開`~/.bashrc`
2. 內容如下:
```bash
export PATH="/c/Users/ahuang11/AppData/Local/Android/Sdk/platform-tools:$PATH"
##----- Android -----
alias adb="/c/EasyAVEngine/Tools/Android/ADB/adb.exe"
alias ad='adb devices'
alias fastboot='/c/EasyAVEngine/Tools/Android/ADB/fastboot.exe'
alias fd='fastboot devices'
##----- Logitech coding -----
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 prj='cd /c/Users/awinh/OneDrive/codes/Logitech/project'
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 p3='/c/Python363/python.exe'
##----- Awin coding -----
alias codes='cd /c/Users/awinh/OneDrive/codes'
alias ctest='code "/g/My Drive/codes/test"'
alias jn='C:/Python310/Scripts/jupyter notebook'
alias ipy='C:/Python310/Scripts/ipython'
##----- ELF -----
alias hugo='~/OneDrive/文件/BLOG/Hugo/bin/0.98_extend/hugo.exe'
##----- MISC -----
alias sl="/c/Program\ Files/Sublime\ Text/subl.exe"
alias e.='explorer.exe .'
alias blog="cd ~/OneDrive/文件/BLOG/Hugo/Sites/blog.awin.one"
alias ffmpeg="/c/Users/awinh/OneDrive/codes/CommonLib/RobotRunCommonLib/ffmpeg-n5.0-latest-win64-lgpl-shared-5.0/bin/ffmpeg.exe"
alias ob="cd ~/OneDrive/文件/Obsidian/Main"
alias ffmpeg="/c/Users/awinh/OneDrive/PortableApps/ffmpeg-n5.0-latest-win64-lgpl-shared-5.0/bin/ffmpeg.exe"
##----- Connection -----
alias gods='ssh awin@192.168.1.11'
alias gorp320='ssh pi@192.168.1.20'
alias gopve='ssh root@192.168.1.21'
##----- 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 py310() {
set_py "3.10" "$@"
}
```
## Setup Windows Terminal
1. 開啟Windows Terminal。
2.`ctrl + ,`打開設定,之後參考[[Windows Terminal]]。
## 恢復右鍵選單
- 以admin身份打開PowerShell執行 `reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve`
- 要恢復Windows 11的右鍵選單則是執行`reg delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f`
## 設定使用者環境變數
- `PYTHON_INCLUDE`: `C:\Python363\include`
- `PYTHON_LIB`: `C:\Python363\libs`
- `RobotRunCommonLib`: `C:\Users\awinh\OneDrive\codes\CommonLib\RobotRunCommonLib`
- `SWIGCmd`: `C:\Users\awinh\OneDrive\PortableApps\swigwin-4.0.2\swig.exe`
# 參考
- [How to open the full right-click menu by default on Windows 11](https://www.xda-developers.com/how-to-open-full-right-click-menu-by-default-windows-11/)
- [【教學】Windows 11 系統優化](https://ofeyhong.pixnet.net/blog/post/225581177)

View File

@@ -0,0 +1,411 @@
## 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
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "paste",
"keys": "ctrl+v"
},
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command":
{
"action": "prevTab"
},
"keys": "ctrl+pgup"
},
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command":
{
"action": "splitPane",
"split": "right"
},
"keys": "ctrl+shift+e"
},
{
"command":
{
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
},
{
"command": "toggleFullscreen",
"keys": "alt+x"
},
{
"command":
{
"action": "newTab"
},
"keys": "ctrl+t"
},
{
"command": "closePane",
"keys": "ctrl+w"
},
{
"command":
{
"action": "splitPane",
"split": "down"
},
"keys": "ctrl+shift+o"
},
{
"command":
{
"action": "nextTab"
},
"keys": "ctrl+pgdn"
}
],
"copyFormatting": "none",
"copyOnSelect": false,
"defaultProfile": "{00000000-0000-0000-ba54-000000000002}",
"initialCols": 234,
"initialPosition": "16,950",
"initialRows": 30,
"profiles":
{
"defaults": {},
"list":
[
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "Windows PowerShell"
},
{
"colorScheme": "Solarized Dark",
"commandline": "gsudo.exe powershell.exe",
"font":
{
"face": "Fira Code"
},
"guid": "{41dd7a51-f0e1-4420-a2ec-1a7130b7e950}",
"hidden": false,
"icon": "C:\\Users\\awinh\\OneDrive\\\u5716\u7247\\icon\\console_red.png",
"name": "Windows PowerShell(Administrator)"
},
{
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"hidden": false,
"name": "Command Prompt"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"commandline": "%PROGRAMFILES%/git/usr/bin/bash.exe -i -l",
"font":
{
"face": "CaskaydiaCove NF",
"size": 12
},
"guid": "{00000000-0000-0000-ba54-000000000002}",
"historySize": 9000,
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
"name": "Bash",
"startingDirectory": "C:\\Users\\awinh\\OneDrive\\codes"
},
{
"guid": "{cb5c3884-260a-5acf-98ef-b546d271b4dd}",
"hidden": false,
"name": "Developer Command Prompt for VS 2022",
"source": "Windows.Terminal.VisualStudio"
},
{
"guid": "{e6386983-3aa0-5a19-a174-f3c66538b7bd}",
"hidden": false,
"name": "Developer PowerShell for VS 2022",
"source": "Windows.Terminal.VisualStudio"
},
{
"guid": "{16208362-94fc-5b1f-a491-5b2624d5ab56}",
"hidden": true,
"name": "Visual Studio Debug Console",
"source": "VSDebugConsole"
}
]
},
"schemes":
[
{
"background": "#0C0C0C",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
},
{
"background": "#012456",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell Powershell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
},
{
"background": "#282C34",
"black": "#282C34",
"blue": "#61AFEF",
"brightBlack": "#5A6374",
"brightBlue": "#61AFEF",
"brightCyan": "#56B6C2",
"brightGreen": "#98C379",
"brightPurple": "#C678DD",
"brightRed": "#E06C75",
"brightWhite": "#DCDFE4",
"brightYellow": "#E5C07B",
"cursorColor": "#FFFFFF",
"cyan": "#56B6C2",
"foreground": "#DCDFE4",
"green": "#98C379",
"name": "One Half Dark",
"purple": "#C678DD",
"red": "#E06C75",
"selectionBackground": "#FFFFFF",
"white": "#DCDFE4",
"yellow": "#E5C07B"
},
{
"background": "#FAFAFA",
"black": "#383A42",
"blue": "#0184BC",
"brightBlack": "#4F525D",
"brightBlue": "#61AFEF",
"brightCyan": "#56B5C1",
"brightGreen": "#98C379",
"brightPurple": "#C577DD",
"brightRed": "#DF6C75",
"brightWhite": "#FFFFFF",
"brightYellow": "#E4C07A",
"cursorColor": "#4F525D",
"cyan": "#0997B3",
"foreground": "#383A42",
"green": "#50A14F",
"name": "One Half Light",
"purple": "#A626A4",
"red": "#E45649",
"selectionBackground": "#FFFFFF",
"white": "#FAFAFA",
"yellow": "#C18301"
},
{
"background": "#002B36",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#FFFFFF",
"cyan": "#2AA198",
"foreground": "#839496",
"green": "#859900",
"name": "Solarized Dark",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
},
{
"background": "#FDF6E3",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#002B36",
"cyan": "#2AA198",
"foreground": "#657B83",
"green": "#859900",
"name": "Solarized Light",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
},
{
"background": "#000000",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#FFFFFF",
"cyan": "#06989A",
"foreground": "#D3D7CF",
"green": "#4E9A06",
"name": "Tango Dark",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
},
{
"background": "#FFFFFF",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#000000",
"cyan": "#06989A",
"foreground": "#555753",
"green": "#4E9A06",
"name": "Tango Light",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
},
{
"background": "#000000",
"black": "#000000",
"blue": "#000080",
"brightBlack": "#808080",
"brightBlue": "#0000FF",
"brightCyan": "#00FFFF",
"brightGreen": "#00FF00",
"brightPurple": "#FF00FF",
"brightRed": "#FF0000",
"brightWhite": "#FFFFFF",
"brightYellow": "#FFFF00",
"cursorColor": "#FFFFFF",
"cyan": "#008080",
"foreground": "#C0C0C0",
"green": "#008000",
"name": "Vintage",
"purple": "#800080",
"red": "#800000",
"selectionBackground": "#FFFFFF",
"white": "#C0C0C0",
"yellow": "#808000"
}
]
}
```
## 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
```