Skip to content

Commit d72045c

Browse files
committed
update
1 parent e58c8b4 commit d72045c

16 files changed

+156
-25
lines changed

.github/workflows/jekyll-gh-pages.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ jobs:
4545
- if: steps.cache-node-modules.outputs.cache-hit != 'true'
4646
run: npm i --production
4747

48-
- run: make update-meta
48+
- run: make meta-update
4949

5050
- name: Build with Jekyll
51-
uses: adoyle-h/[email protected]6
51+
uses: adoyle-h/[email protected]7
5252
with:
5353
source: ./
5454
destination: ./_site

.github/workflows/weekly-report.yml

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222

2323
- name: Scan
2424
id: report
25+
continue-on-error: true
2526
run: |
2627
c=$(git rev-list --all --since '1 week ago' --reverse | head -n1 || true)
2728
[ -z ${c:-} ] && exit 31
@@ -54,6 +55,7 @@ jobs:
5455
category-id: DIC_kwDOAykUvs4CfgjB
5556

5657
- name: Print discussion url and id
58+
if: ${{ steps.create-discussion.conclusion == 'success' }}
5759
run: |
5860
echo discussion-id: ${{steps.create-discussion.outputs.discussion-id}}
5961
echo discussion-url: ${{steps.create-discussion.outputs.discussion-url}}

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ serve:
99
echo "You should press 'ctrl-c' when \"Auto-regeneration: enabled for '/src/site'\" appeared."
1010
docker run -it --rm -p 4000:4000 -v "${PWD}:/src/site" ${GH_PAGE_IMAGE}
1111

12-
.PHONY: update-readme
13-
update-readme:
12+
.PHONY: readme-update
13+
readme-update:
1414
@node ./_doc_builder/update-readme.mjs
1515

16-
.PHONY: update-meta
17-
update-meta:
16+
.PHONY: meta-update
17+
meta-update:
1818
@node ./_doc_builder/update-meta.mjs
1919

2020
# 本地构建

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
184184
- [学习 Docker](docker/docker-learning.md)
185185
- [Docker OverlayFS](docker/docker-overlayfs.md)
186186
- [Docker 的坑](docker/docker-pitfalls.md)
187+
- [docker 代理](docker/docker-proxy.md)
187188
- [Docker Run With Namespace](docker/docker-run-with-namespace.md)
188189
- [Docker Tag/Id/Digest](docker/docker-tag-id-digests.md)
189190
- [docker 小技巧](docker/docker-tricks.md)
@@ -792,6 +793,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
792793
- [如何审核代码](others/how-to-review-code.md)
793794
- [httrack](others/httrack.md)
794795
- [Hyper.js 中文问题](others/hyper-js-chinese-problems.md)
796+
- [图床](others/image-board.md)
795797
- [无法在 Tmux 显示图片](others/imgcat-not-work-in-tmux.md)
796798
- [Jekyll](others/jekyll.md)
797799
- [jellyfin 中文字体](others/jellyfin-chinese-font.md)
@@ -990,7 +992,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
990992

991993
## Vim
992994

993-
- [<C-I> 在 nvim 里等同于 <Tab>](vim/ctrl-i-in-neovim.md)
995+
- [`<C-I>` 在 nvim 里等同于 `<Tab>`](vim/ctrl-i-in-neovim.md)
994996
- [用于调试的最小 neovim 配置](vim/minimal-nvim-config-for-reproduce.md)
995997
- [学习 Neovim](vim/neovim-learning.md)
996998
- [在 vim 中执行 shell 命令,同时将结果输出到 buffer](vim/pipe-shell-output-to-buffer.md)

android/termux.md

+9
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,12 @@ apt、dpkg 和 Debian 的一模一样,尽量少做修改,只用来查询。
4444

4545
1. `pkg install resolv-conf` 确保已安装 resolv-conf 包。
4646
2. Termux 使用的 resolv.conf 路径在 `/data/data/com.termux/files/usr/etc/resolv.conf`,直接修改内容即可,不需要 root 权限。
47+
48+
## chmod +x 无用
49+
50+
有时候 `chmod +x` 让文件可执行,虽然命令没报错,但是脚本依然还是不可执行的。
51+
52+
这是正常的。当文件存储在安卓系统的外部存储中,即 /storage/emulated/0。无法赋予可执行权限。
53+
54+
因为 /storage/emulated 是用 fuse 文件系统挂载的。在 termux 中执行 `mount | grep storage` 可以看到,它的挂载参数有 noexec。这代表着外部存储文件没有可执行权限。
55+
如果不 root 手机,则无法修改挂载选项。

design/color-space.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080

8181
[色度图 (Chromaticity Diagram)](https://www.wikiwand.com/zh-hans/%E8%89%B2%E5%BA%A6_(%E7%89%A9%E7%90%86%E5%AD%B8))
8282

83-
![色彩空间对比图](https://www.viewsonic.com/library/wp-content/uploads/2019/04/LB0055-2-compressed.jpg)
83+
![色彩空间对比图](https://media.githubusercontent.com/media/adoyle-h/_imgs/master/picgo/%E8%89%B2%E5%BD%A9%E7%A9%BA%E9%97%B4%E5%AF%B9%E6%AF%94%E5%9B%BE.jpg)
8484

8585
## [色域](./color-gamut.md)
8686

docker/docker-learning.md

-15
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@
55
- [docker-cheat-sheet](https://github.com/wsargent/docker-cheat-sheet)
66
- [Docker — 从入门到实践](https://github.com/yeasy/docker_practice)
77

8-
### 代理
9-
10-
因为国内用 docker pull 会非常慢。建议使用阿里云的 docker 镜像加速。得到 mirror 地址,对于 dokcer for mac 用户,打开设置 - Docker Engine,加上这段配置,
11-
12-
```json
13-
{
14-
"registry-mirrors": [
15-
"https://你的地址.mirror.aliyuncs.com"
16-
]
17-
}
18-
```
19-
20-
这里必须用 https,虽然可能提示证书不对。使用 http 会无效。
21-
22-
238
### [制作镜像](./dockerfile.md)
249

2510
#### alpine apk update 总是失败

docker/docker-proxy.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# docker 代理
2+
3+
加速 docker pull 的几种方法
4+
5+
1. 通过 registry-mirror 镜像服务器来加速
6+
2. 通过代理服务来加速
7+
8+
## docker for mac
9+
10+
对于 dokcer for mac 用户,打开设置 - Docker Engine,设置 registry-mirror 配置。
11+
12+
## orbstack
13+
14+
对于 [orbstack](https://orbstack.dev/) 用户,
15+
通过 `orb config docker` 或者在 app 界面的「设置-Docker-Advanced engine config」设置 registry-mirror 配置。
16+
或者,通过 `orb config set network_proxy` 或者在 app 界面的「设置-Network-Proxy」设置代理。
17+
18+
## registry-mirror
19+
20+
因为国内用 docker pull 会非常慢。建议使用 docker 镜像加速。
21+
22+
```json
23+
{
24+
"registry-mirrors": [
25+
"https://镜像加速服务"
26+
]
27+
}
28+
```
29+
30+
这里必须用 https,虽然可能提示证书不对。使用 http 会无效。
31+
32+
镜像加速服务可参考 https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6
33+
34+
## 代理服务
35+
36+
根据[这个文档](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy),下面这种配置方式是可用的。
37+
38+
```json
39+
{
40+
"proxies": {
41+
"http-proxy": "http://localhost:3128",
42+
"https-proxy": "http://localhost:3129",
43+
"no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
44+
}
45+
}
46+
```
47+
48+
49+
要区分[这篇文章](https://docs.docker.com/network/proxy/#configure-the-docker-client),下面的配置是用来配置 docker 客户端,而非 docker 服务端。它是用来设置容器的里的代理配置,而非 docker 服务器的代理配置,即不影响 docker pull。
50+
51+
```json
52+
{
53+
"proxies": {
54+
"default": {
55+
"httpProxy": "http://proxy.example.com:3128",
56+
"httpsProxy": "https://proxy.example.com:3129",
57+
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
58+
}
59+
}
60+
}
61+
```

docker/docker-tricks.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ ENTRYPOINT ["tail", "-f", "/dev/null"]
1717

1818
这在缺失 Dockerfile 的情况下有一定帮助。
1919

20+
<!-- {% raw %} -->
2021
`docker history --no-trunc --format '{{.CreatedBy}}' <image>`
22+
<!-- {% endraw %} -->
2123

2224
因为 docker history 默认会裁减输出,所以要加上 `--no-trunc` 参数。
2325

@@ -34,7 +36,9 @@ Perhaps iptables or your kernel needs to be upgraded.
3436
### docker format 的工具函数
3537

3638
比如查看可以输出哪些字段,用 `json`,例如
39+
<!-- {% raw %} -->
3740
`docker container ls --format='{{json .}}'`
41+
<!-- {% endraw %} -->
3842

3943
https://docs.docker.com/config/formatting/
4044

docker/find-which-container-includes-overlay.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## 查找 Overlay ID 与哪个容器相关
22

3+
<!-- {% raw %} -->
34
`docker inspect -f $'{{.Name}}\t{{.GraphDriver.Data.MergedDir}}' $(docker ps -aq) | grep -i <overlay-id>`
5+
<!-- {% endraw %} -->
46

57
### 案例
68

linux/nsenter.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
`/var/run/netns` 没有容器创建的网络命名空间(以下简称 netns)。这是因为 `docker`(或者说 `containerd`)在创建 netns 后就把它从 `/var/run/netns` 删掉了。
44

5+
<!-- {% raw %} -->
56
`docker inspect --format '{{.State.Pid}}' <container_name_or_Id>` 查询容器的 pid。
7+
<!-- {% endraw %} -->
68

79
利用 `nsenter -t <contanier_pid> -n <command>` 命令可以方便的调试这个命名空间。
810

others/image-board.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 图床
2+
3+
cloudflare r2 是一个对象存储服务。可以免费限额存储数据。
4+
5+
1. 先创建 bucket。
6+
2. 配置域名。
7+
3. 在「管理 R2 API 令牌」创建 API 令牌。限制只读写刚刚创建的 bucket。
8+
9+
[picgo](https://github.com/Molunerfinn/PicGo) 是个上传图片到对象存储服务的 GUI 工具。
10+
11+
1. 安装 picgo
12+
2. 安装 s3 插件(不要安装 s3-lls)
13+
3. 在图床设置-Amazon S3 里设置,以下都是必填项
14+
- 图床配置名:随便起名
15+
- 应用密钥 ID:填 cloudflare API 令牌「访问密钥 ID」的值
16+
- 应用密钥:填 cloudflare API 令牌「机密访问密钥」的值
17+
- 桶名:bucket 的名称
18+
- 自定义节点:填「为 S3 客户端使用管辖权地特定的终结点」的值
19+
- 代理:填自己的梯子的地址,如果没用代理,在中国无法成功上传
20+
- 自定义域名:填上面配置的域名

others/jekyll.md

+15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
2. Jekyll 可以通过 `markdown: GFM` 来切换 markdown 解析器,但是这个解析器也有问题。当 heading 包含中文,生成的 `<a>` 标签里的锚点不是中文。
1111
3. `markdown: CommonMarkGhPages``markdown: GFM` 效果基本一样,问题相同。
1212
3. Github Page 目前使用的 Jekyll 3。而 Jekyll 最新都出到 4 了。而且 [Github Page 维护者说不会升级](https://github.com/github/pages-gem/issues/651#issuecomment-1208290235)
13+
4. 在 md 文件里写 `{{...}}`,最后渲染是空的。
1314

1415
## 如何改变 url path 格式
1516

@@ -38,3 +39,17 @@ Github 提供了 [pages-gem](https://github.com/github/pages-gem) 来一键安
3839

3940
然而 pages-gem 可能存在一个问题,导致在本地 `jekyll build` 以及 `jekyll serve` 得到的 index.html 格式不对。
4041
详见 https://github.com/github/pages-gem/issues/657
42+
43+
## `{{...}}` 渲染为空的问题
44+
45+
实际上 jekyll 编译时会报警告 `Liquid Warning: Liquid syntax ... is not a valid expression ...`。然后 `{{...}}` 部分渲染为空。
46+
47+
具体参考[这篇文章](https://redgreenrepeat.com/2020/10/23/how-to-display-double-curly-braces-code-in-jekyll/)
48+
49+
解决方法:用 [raw tag](https://shopify.github.io/liquid/tags/template/#raw) 包裹。
50+
51+
```markdown
52+
<!-- {% raw %} -->
53+
`docker container ls --format='{{json .}}'`
54+
<!-- {% endraw %} -->
55+
```

others/makefile.md

+25
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [注意 &&](#注意-)
2222
- [GNU make 与 BSD make 的区别](#gnu-make-与-bsd-make-的区别)
2323
- [GNU make 会自动打印目录路径](#gnu-make-会自动打印目录路径)
24+
- [$() 会提前执行](#-会提前执行)
2425

2526
<!-- /MarkdownTOC -->
2627

@@ -277,3 +278,27 @@ a:
277278
@echo "$(shell $(MAKE) -s b)"
278279
```
279280

281+
## $() 会提前执行
282+
283+
```makefile
284+
.PHONY: a
285+
a:
286+
@echo 1 > VERSION
287+
@echo "VERSION=$(shell cat VERSION)"
288+
```
289+
290+
当先用 `echo 2 > VERSION`,在执行 `make a`,会发现它输出的是 `VERSION=2`,并不是 `VERSION=1`。
291+
这说明 `$(shell cat VERSION)` 并不是等到执行 `@echo "VERSION=$(shell cat VERSION)"` 时执行的,而是提早执行计算好了结果。
292+
293+
如果想推迟 `$(shell cat VERSION)`,可以这么改:
294+
295+
```makefile
296+
.PHONY: a
297+
a:
298+
@echo 1 > VERSION
299+
@$(MAKE) -s b
300+
301+
.PHONY: b
302+
b:
303+
@echo "VERSION=$(shell cat VERSION)"
304+
```

others/reverse-quote-in-markdown.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
Q: 如何在反引号的句子里写反引号?
44

5-
A: 最外层用两个反引号代替,内容直接写反引号。参考 https://www.v2ex.com/t/57233
5+
A: 最外层用两个反引号代替,内容直接写反引号。比如
6+
7+
``git archive master --format=zip > `git describe master`.zip``
8+
9+
`` ctrl+` `` 注意这里要加首尾空格以避免三个反引号。

vim/ctrl-i-in-neovim.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## <C-I> 在 nvim 里等同于 <Tab>
1+
## `<C-I>` 在 nvim 里等同于 `<Tab>`
22

33
问题不在于 nvim,而是在终端模拟器。在终端里按 `<C-I>` 也会跟 `<Tab>` 一样进行代码补全。
44

0 commit comments

Comments
 (0)