Skip to content

Commit dcd5edb

Browse files
committed
vault backup: 2025-06-27 20:38:13
1 parent 9822971 commit dcd5edb

17 files changed

Lines changed: 691 additions & 8 deletions

File tree

.obsidian/community-plugins.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"link-favicon",
99
"webpage-html-export",
1010
"obsidian-version-history-diff",
11-
"obsidian-git"
11+
"obsidian-git",
12+
"markdown-table-editor"
1213
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"handleNativeTable": true,
3+
"hackPDF": false
4+
}

BroswerExtension/index.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
- 项目信息,权限申请等
1515
- 在根目录下
1616
- service worker
17-
- 监听事件等,比如快捷键
18-
- 通常是根目录下的 background.js(设其`background.service_worker`
19-
- [支持的事件/API](https://developer.chrome.com/docs/extensions/mv3/service_workers/events/)
17+
- 监听事件等,比如快捷键
18+
- 通常是根目录下的 background.js(设其`background.service_worker`)
19+
- [支持的事件/API](https://developer.chrome.com/docs/extensions/mv3/service_workers/events/)
2020
- content scripts
21-
- 内容脚本文件,即对页面的脚本
22-
- 通常是根目录下的 scripts,需要设置在`content_scripts`中,为 scrpits 分组,每组可以包含多个 js 文件,多个 matches 规则
21+
- 内容脚本文件,即对页面的脚本
22+
- 通常是根目录下的 scripts,需要设置在`content_scripts`中,为 scrpits 分组,每组可以包含多个 js 文件,多个 matches 规则
23+
- 基本上就只能使用chrome.runtime
2324
- The popup and other pages
24-
- 弹出页面(点击插件图标时弹出)和其他页面
25-
- popup 可以单独立写在 popup 目录
25+
- 弹出页面(点击插件图标时弹出)和其他页面
26+
- popup 可以单独立写在 popup 目录
2627
- 交互模式
2728
- 基于`chrome.action.onClick`的全自动模式(点击扩展仅仅启动扩展,可以在 Badge 中显示 text 告诉用户是否开启了)
2829
- 逻辑主要集中在 background 和 content scripts

Golang/Libs/Copy.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [copier](https://github.com/jinzhu/copier):默认`copier.Copy(&to, &from)`不设置from没有的值、from的零值也会进行设置、nil值不会拷贝
2+
- 忽视零值:`copier.CopyWithOption(&to, &from, copier.Option{IgnoreEmpty: true})`

IDE/VSCode/VSCode功能.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# 配置文件
2+
+ 可以导出导入
3+
+ 默认使用默认配置文件,可以创建新的配置文件,并在几个配置文件之间进行切换
4+
+ 对象:用户(所有/当前用户(安装方式)),所有工作区,当前工作区
5+
6+
# 用户代码片段
7+
+ snippets
8+
- 保存在`/C:/Users/LYM/AppData/Roaming/Code/User/snippets/xxx.json`
9+
+ `$0`是最终光标位置,`$n`是第n个参数位置(从1开始)
10+
- 按tab会到下一个参数位置
11+
12+
```json
13+
"snippetsName": {
14+
"prefix":"",
15+
"body":[
16+
"printf(\"$1\",$2);"
17+
],
18+
"description": ""
19+
}
20+
```
21+
22+
23+
24+
# workspace
25+
+ Single Folder Workspace:就是一个工作目录
26+
- 目录名就是Workspace名
27+
+ Multi-Root Workspace:一个工作目录包含多个不同的目录,每个目录相互隔离
28+
- 把配置保存为`{name}.code-workspace` (JSON文件)
29+
* 文件名就是Workspace名
30+
* folders中的每个folder:
31+
+ path指定folder(项目)的路径(相对于该.code-workspace文件或者绝对路径)
32+
+ name指定folder(项目)的名字(显示的是name,而不是目录名)
33+
* settings:这个workspace的配置
34+
+ [launch、task、git等](https://code.visualstudio.com/docs/editor/multi-root-workspaces#_workspace-launch-configurations)
35+
36+
37+
38+
39+
40+
41+
File renamed without changes.

IDE/VSCode/index.md

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
- task
2+
- [Visual Studio Code 中的任务](https://code.visualstudio.com/docs/editor/tasks)
3+
- [Visual Studio Code Tasks Appendix](https://code.visualstudio.com/docs/editor/tasks-appendix)
4+
+ ${}引用的变量
5+
- [Visual Studio Code Variables Reference](https://code.visualstudio.com/docs/editor/variables-reference)
6+
+ launch
7+
- [在 Visual Studio Code 中调试](https://code.visualstudio.com/docs/editor/debugging)
8+
9+
# 介绍
10+
+ vscode是纯编辑器,不过因为其强大的插件功能而强大
11+
+ 命令面板:Ctrl+Shift+P,执行命令(插件命令,官方命令,@就扫描当前文件进行执行)
12+
13+
# vscode写代码逻辑
14+
+ vscode打开的目录叫**workplace**
15+
- 在下面编写代码
16+
- .vscode目录是vscode的配置
17+
* launch.json:执行启动(执行语言的可执行文件)/附加(即Debug一个进程)命令
18+
+ 主要视图是Topbar的Run、LeftSidebar的Run And Debugger(可以选择一个配置对象运行)
19+
* tasks.json: 编译等命令
20+
+ 主要视图是Topbar的Terminal
21+
- 运行生成任务:就是进行build,其他不是build,而是在build上操作,运行其他命令
22+
+ 写在tasks属性外的,作用在每个task上
23+
24+
# 配置
25+
## tasks.json
26+
+ [task接口定义](https://code.visualstudio.com/docs/editor/tasks-appendix)
27+
+ windows:windows特定命令
28+
+ linux:linux特定命令
29+
+ tasks:task执行一个命令(编译命令)
30+
- type:规定好的,比如go,java,cppbuild。。。
31+
* 但是实际上只有2种,shell和process(作为一个进程执行)
32+
- label:该任务的名字
33+
- command:执行的命令(可以是绝对路径,比如go,如果go的bin目录在环境变量path中,则可以直接写go)
34+
- args:一个数组,写命令的参数
35+
* 当然可以在command中写,args就不用了(args不用为参数加单引号作为字符串---防止空格,但是如果直接写在command需要加单引号如果参数有空格)
36+
- detail:显示任务的详细信息
37+
- presentation:表现形式
38+
* panel=new:每次都是新窗口,=shared:共享一个窗口(默认),=dedicated:不同任务使用不同窗口,但是继续使用打开的窗口
39+
* clear=false:每次都不会清空窗口内容(默认)
40+
* reveal=always:面板始终位于前面(默认)
41+
* close=false:表示执行完命令不关闭(默认)
42+
- options
43+
* 覆盖 the defaults for (current working directory), (environment variables), or (default shell)
44+
* env:添加环境变量
45+
+ 测试:`command : "sh ./test.sh"` 写入像`echo $GOROOT`这样打印环境变量
46+
* cwd:命令执行路径,默认`${workspaceFolder}`
47+
* shell:shell程序
48+
- group
49+
* kind:有test,build,none(表示没有组,默认值)
50+
* `"group": { "isDefault":true, kind:"test" } / "group": "test"`
51+
+ group默认是default,ctrl+shift+p执行Run Test/Build Task会直接运行默认任务,不是默认的需要手动执行
52+
- dependsOn:数组
53+
* 依赖某些任务,即dependsOn先执行,再执行本任务(本任务可以什么都不做,就执行该依赖== 指定顺序执行任务)
54+
- dependsOrder:依赖执行顺序
55+
* 默认parallel,即并行执行dependsOn的任务
56+
* sequence,顺序执行dependsOn的任务
57+
- runOptions:定义什么时候如何运行任务
58+
59+
## launch.json
60+
+ 每一种`type`可以配置属性有一样的,也有不一样的
61+
- 比如对于java就有vmArgs属性
62+
+ [https://code.visualstudio.com/docs/editor/debugging#_run-and-debug-view](https://code.visualstudio.com/docs/editor/debugging#_run-and-debug-view)
63+
+ `request``launch/attach`
64+
+ `args`:在cmd执行的命令最后追加
65+
+ 一般会执行所有configuration对象,相同type的,也可能不都执行(执行一下其他可以直接启动的)
66+
- 因此可以这配置一点,那配置一点,如下
67+
68+
```json
69+
{
70+
"version": "0.2.0",
71+
"configurations": [
72+
{
73+
"type": "java",
74+
"name": "Launch with Arguments Prompt",
75+
"request": "launch",
76+
"mainClass": "",
77+
"args": "${command:SpecifyProgramArgs}"
78+
},
79+
{
80+
"type": "java",
81+
"name": "Main",
82+
"request": "launch",
83+
"mainClass": "com.liruo.vscode.Main",
84+
"projectName": "java-red-hat-server_bccc830c"
85+
}
86+
]
87+
}
88+
89+
```
90+
91+
# 例子
92+
## tasks.json
93+
```json
94+
{
95+
"tasks": [
96+
//a c++ example
97+
{
98+
"type": "process",
99+
"label": "cpp build",
100+
"command": "g++",
101+
"args": [
102+
"-fdiagnostics-color=always",
103+
"-g",
104+
"${file}",
105+
"-o",
106+
"${fileDirname}\\${fileBasenameNoExtension}.exe"
107+
],
108+
"options": {
109+
"cwd": "${fileDirname}"
110+
},
111+
"problemMatcher": [
112+
"$gcc"
113+
],
114+
"group": {
115+
"kind": "build",
116+
"isDefault": true
117+
},
118+
"detail": "a c++ build task"
119+
},
120+
//options
121+
{
122+
"type": "shell",
123+
"label": "shell cmd",
124+
"command": "sh ./test.sh",
125+
"options": {
126+
"env": {
127+
"env1": "addtional-env1"
128+
},
129+
"cwd": "${workspaceFolder}/cwd-test"
130+
},
131+
"group": "test"
132+
},
133+
//Default task and no Default task
134+
{
135+
"type": "shell",
136+
"label": "test 2",
137+
"command": "echo 11111",
138+
"group": {
139+
"kind": "test",
140+
"isDefault": true
141+
}
142+
},
143+
//dependsOn
144+
{
145+
"type": "shell",
146+
"label": "dependsOn1",
147+
"command": "echo 1111",
148+
},
149+
{
150+
"type": "shell",
151+
"label": "dependsOn2",
152+
"command": "echo 2222",
153+
},
154+
{
155+
"type": "shell",
156+
"label": "dependsOn3",
157+
"command": "echo 3333",
158+
"dependsOrder": "sequence",
159+
"dependsOn":["dependsOn2", "dependsOn1"]
160+
}
161+
],
162+
"version": "2.0.0"
163+
}
164+
```
165+
166+
## launch.json
167+
```json
168+
{
169+
"version": "0.2.0",
170+
"configurations": [
171+
//a go example
172+
{
173+
"name": "Launch Package",
174+
"type": "go",
175+
"request": "launch",
176+
"mode": "auto",
177+
"program": "${fileDirname}"
178+
},
179+
//a c++ example
180+
{
181+
//在label=build的任务之后执行
182+
"preLaunchTask": "build",
183+
"name": "cpp-run",
184+
"type": "cppdbg",
185+
"request": "launch",
186+
"program": "${workspaceFolder}\\bin\\${fileBasenameNoExtension}.exe",
187+
"args": [],
188+
//命令工作的路径,默认是workspaceFolder
189+
"cwd": "${workspaceFolder}",
190+
"stopAtEntry": false,
191+
"environment": [],
192+
"MIMode": "gdb",
193+
"externalConsole": false,
194+
"miDebuggerPath": "gdb",
195+
"setupCommands": [
196+
{
197+
"description": "为 gdb 启用整齐打印",
198+
"text": "-enable-pretty-printing",
199+
"ignoreFailures": true
200+
},
201+
{
202+
"description": "将反汇编风格设置为 Intel",
203+
"text": "-gdb-set disassembly-flavor intel",
204+
"ignoreFailures": true
205+
}
206+
]
207+
}
208+
]
209+
}
210+
```
211+
212+
# vscode变量
213+
## 变量
214+
+ **workspaceFolder** :vscode 打开的目录的路径----工作目录
215+
- **workspaceFolderBasename**
216+
* 工作目录名
217+
+ **fileDirname** :选中文件的路径的目录路径
218+
- **fileDirnameBasename**
219+
+ **file** :选中文件的路径
220+
- **fileBasename**:选中文件的文件名(单纯只是文件名)
221+
* **fileBasenameNoExtension** :选中文件的的无扩展名的文件名
222+
* **fileExtname** :选中文件的扩展名
223+
+ **relativeFile** :是相对工作目录的路径
224+
- 如work\demo\c.cpp
225+
* relativeFile=demo\c.cpp
226+
* **relativeFileDirname**=demo
227+
+ **cwd**:当前命令运行目录的路径
228+
229+
230+
231+
## 案例
232+
Supposing that you have the following requirements:
233+
234+
1. A file located at /home/your-username/your-project/folder/file.ext opened in your editor;
235+
2. The directory /home/your-username/your-project opened as your root workspace.
236+
237+
So you will have the following values for each variable:
238+
239+
+ **${userHome}** - /home/your-username
240+
+ **${workspaceFolder}** - /home/your-username/your-project
241+
+ **${workspaceFolderBasename}** - your-project
242+
+ **${file}** - /home/your-username/your-project/folder/file.ext
243+
+ **${fileWorkspaceFolder}** - /home/your-username/your-project
244+
+ **${relativeFile}** - folder/file.ext
245+
+ **${relativeFileDirname}** - folder
246+
+ **${fileBasename}** - file.ext
247+
+ **${fileBasenameNoExtension}** - file
248+
+ **${fileDirname}** - /home/your-username/your-project/folder
249+
+ **${fileExtname}** - .ext
250+
+ **${lineNumber}** - line number of the cursor
251+
+ **${selectedText}** - text selected in your code editor
252+
+ **${execPath}** - location of Code.exe
253+
+ **${pathSeparator}** - / on macOS or linux, \ on Windows
254+
255+
## 环境变量
256+
+ `${env:envName}`
257+
258+
## settings.json的属性
259+
+ `${config:configName}`
260+
- 也可以在settings.json中使用
261+

IDE/VSCode/代理.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
```json
2+
{
3+
//VSCode是不会走系统代理的,只能配置VSCode的代理设置
4+
//默认是环境变量http_proxy、https_proxy
5+
//远程开发会关闭这个
6+
"http.proxy": "http://127.0.0.1:7890",
7+
//不进行代理的domain
8+
"http.noProxy": [],
9+
//请求头Proxy-Authorization
10+
"http.proxyAuthorization": null,
11+
//使用kerberos认证而不用请求头Proxy-Authorization
12+
"http.proxyKerberosServicePrincipal": ""
13+
//是否验证代理服务器证书
14+
"http.proxyStrictSSL": true,
15+
//允许扩展使用此代理配置
16+
//override=强制使用扩展使用,fallback=扩展没有配置或者取消代理则使用
17+
//不过,当axios配置proxy时,override无法覆盖
18+
"http.proxySupport": "override",
19+
//远程开发时是否使用本地的代理配置
20+
"http.useLocalProxyConfiguration": true,
21+
//远程开发代理地址
22+
"remote.SSH.httpProxy": "",
23+
"remote.SSH.httpsProxy": "",
24+
//为true时才允许fetch使用vscode代理设置
25+
"http.fetchAdditionalSupport": true
26+
}
27+
```

IDE/VSCode/常用配置.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
# 编码
4343
```json
4444
{
45+
//项目文件默认读写编码---记得先关闭所有文件再修改
46+
// 注意, 如果文件本来是GBK, 这里却设置为UTF-8,则会乱码,因为VSCode不会自动转换,而是以UTF-8读取文件
47+
//其他编译运行等插件都使用这个,而不是自定义一个类似的配置,除非是构建工具,构建工具全部都按其自己的规则
48+
//特别注意: 像那些Language Server在开始时就读取了配置, 不是插件自己的配置,可能感知不到变化。
49+
// 比如修改这个files.encoding导致Language Server使用旧编码编译,从而导致乱码
50+
// 解决方法:删除缓存重启Language Server(比如RedHat的Java Language Server)
4551
"files.encoding": "utf8",
4652
  "files.autoGuessEncoding": true,
4753
  "files.candidateGuessEncodings": [],

0 commit comments

Comments
 (0)