Blog [0005]
- February 08, 2026
Blog [0005]
- February 08, 2026
Post什么是“缠绕沈子纲之铁链” [000W]
- May 05, 2026
Post什么是“缠绕沈子纲之铁链” [000W]
- May 05, 2026
如果在一些在线英汉汉英词典(如欧路词典)上查询 dangles(注意并非 dangle)这个词,会得到一个奇怪的义项:“n. 缠绕沈子纲之铁链”。这个义项令人十分迷惑:谁是沈子纲(这听上去很像一个人名),或者说,什么是沈子纲?为什么要用铁链缠绕沈子纲?为什么 dangles 会被联系到这个义项?
这激起了我的好奇心。此时,如果是熟悉渔业专业英语的人,已经能大致知道背后的来龙去脉甚至可能并不觉得奇怪。遗憾的是,我并不熟悉渔业专业英语。
于是我在网络上查询“缠绕沈子纲之铁链”。搜索结果几乎全部是无关结果,主要来自“缠绕”和“铁链”这两个关键词,然而结果中也有其他若干英汉汉英词典或翻译网站,无一例外在它们的“网络释义”中将 dangles 这个词解释为“缠绕沈子纲之铁链”。幸运的是,必应词典提供了这个“网络释义”义项的来源:“食品论坛” BBS 的“水产”板块中,有用户提问“谁能提供关于水产的英语词汇”,而回复中有一位神秘人贴出了大量独家汉英词汇对照。在页面上搜索 dangles,果然该神秘人将其解释为“缠绕沈子纲之铁链”。到了这一步,这个义项的来源已经解明。剩下的问题是:什么是“沈子纲”?什么又是“缠绕沈子纲之铁链”?为什么要用铁链缠绕沈子纲?
此时,如果是更聪明的人,已经能快速知道“沈子纲”对应的是什么。遗憾的是,我并没有这么聪明。
于是我在网络上查询“沈子纲”。可以看出这个词汇的确很像个人名,因为搜索结果几乎都与各种人物有关。不过,其中出现了一个英文词汇 footrope 的百度百科页面,其解释为:“footrope,英语单词,主要用作为名词,用作名词译为‘沈子纲’。”
此时,如果是熟悉渔业专业英语的人,已经能几乎完全明白背后的来龙去脉。遗憾的是,我并不熟悉渔业专业英语。
我恍然大悟,回到食品论坛的那个页面搜索“沈子纲”,果然该神秘人同样列出了这对词汇。将两个英文词语在渔业领域的意思交叉对比,可以得知 footrope 指的是渔网底部带有配重以使得网具下沉并张开成特定形状的绳索,而 dangles,如神秘人所言,是缠绕 footrope 之铁链,起到配重与惊起海中的底栖生物以便于打捞的双重作用。
问题是,这个东西为什么会被神秘人称为“沈子纲”呢?如果这是通用的译名或译法,为什么会查询不到任何结果?
此时,如果是对汉字足够敏感的人,已经能从上下文中猜测到正确答案。遗憾的是,我对汉字同样不够敏感。
于是我继续查看“沈子纲”的搜索结果。令人意外的是,这个日文网页提到了“沈子綱”在日文中的存在。到了这一步,在日文汉字的提示下,我终于还是对汉字产生了一定的敏感:这个“沈子纲”,在中国大陆的语境下,是不是应该被写成“沉子纲”呢?
于是我搜索“沉子纲”,得到大量与渔业有关的搜索结果,简单阅读之后确认和之前的 footrope 这个英文词汇指的是同一个东西。结合这一点搜索,可以得知 dangles 所对应的东西并没有一个通用的专名或译法,但或许可称为“垂链”“吊链”“悬垂索具”等等,或者,如一开始的神秘义项所云,是“缠绕沉子纲之铁链”。只是不知为何,食品论坛的神秘人可能受到日语影响,将“沉子纲”写成了“沈子纲”。
PostMagit in Terminal [0004]
- November 11, 2025
PostMagit in Terminal [0004]
- November 11, 2025
The following is a script I use to open Magit in current directory from terminal:
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
emacsclient -c -n -a emacs -e "(progn (magit-status \"${git_root}\") (delete-other-windows))"
if [[ -f `which osascript` ]]; then
osascript -e "tell application \"Emacs\" to activate"
fi
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
emacsclient -c -n -a emacs -e "(progn (magit-status \"${git_root}\") (delete-other-windows))"
if [[ -f `which osascript` ]]; then
osascript -e "tell application \"Emacs\" to activate"
fi
I put this script in my PATH as magit, so I can just run magit in any git repository from terminal to open Magit in Emacs. The original source for this script comes from Christian Tietze’s post, and I have modified it to make it create a new frame with only one window showing Magit status. I also created another script with -nw in place of -c -n and removed the part that activates Emacs to open Magit in TTY Emacs directly.
PostFinding Room for Keybindings in Emacs [0003]
- November 27, 2025
PostFinding Room for Keybindings in Emacs [0003]
- November 27, 2025
There are so many commands that I want to bind to keys in Emacs, but the keyboard is crowded already. In the Key Binding Conventions section in the GNU Emacs Lisp Reference Manual, it says that C-c followed by a letter as well as F5 through F9 are reserved for users. However, I, just like any sane Emacs user would do, tries to put groups of related commands under prefixes, which means that such a commmand needs at least three keystrokes to invoke (the C-c, the letter prefix, and the keybinding in the prefix). This is anti-productive.
Luckily, there are some keybindings in Emacs that are not that useful for me (and maybe others as well), so I can repurpose them for my own use. The following are some of such keybindings. Note that many of these are useless for me because they are more relevant to terminal Emacs, while I almost always use Emacs in a graphical environment, so YMMV.
C-z: By default, this is bound tosuspend-frame, which could be replaced by the window manager’s own shortcut for minimizing windows on most systems. It may still be useful on terminal Emacs though.C-t: This is bound totranspose-chars, which turnsa|bcintoba|c(where|is the cursor). Does anyone really use this? I never do. (But I do find other transpose commands useful.)M-`: This is bound totmm-menubar, which shows a text-based menu bar, which is not very useful in graphical Emacs.C-iandC-m: Due to historical reasons, these are, by default, recognized asTABandRETrespectively. This is still relevant in terminal Emacs, since some terminals may not be able to distinguish them. But in graphical Emacs, it is possible to distinguish these control characters fromTABandRET, see these relevant discussions on Emacs Stack Exchange.
That gives me at least five more prefixes to use for my own keybindings, which saves me a lot of keystrokes, and I hope it helps you as well. Happy hacking!
PostHow to Find a Color Scheme Quickly [0002]
- April 19, 2025
PostHow to Find a Color Scheme Quickly [0002]
- April 19, 2025
There are always things in the world that require some level of visual design. Taking some things I’ve had to do recently as examples: creating slideshows, drawing charts for papers, making posters, and designing my homepage – having some design is always better than having none. In the design process, choosing fonts is relatively simple. After doing this a few times, you slowly build up a set of fonts that can be combined for various occasions. While layout has many details, as long as you follow some basic principles like alignment, white space, contrast, and unity, the result won’t be poor. However, choosing a color scheme is often the hardest part for me.
Criteria for Choosing a Color Scheme
Criteria for Choosing a Color Scheme
A “color scheme” isn’t just a set of colors found randomly via a search engine or produced by a generator. Most such schemes are just a collection of color blocks and RGB values. They might look okay at first glance, but for a non-professional like me, it’s hard to directly apply them to actual designs. This is just a mere collection of colors, not a truly usable color scheme. For me, a color scheme should meet these criteria:
- Clearly defines the purpose of each color, such as background color, text color, accent color, etc.
Based on the defined color purposes, meets certain accessibility standards, including:
- Sufficient contrast between text and background.
- Colorblind-friendly.
Where to Find Color Schemes
Where to Find Color Schemes
After several fruitless attempts, I decided not to waste time on search engines anymore. My inspiration came one day when I was staring at my Emacs. At that moment, I suddenly realized that code editor color schemes are arguably a perfect solution because they:
- Have very clear color purposes.
- Usually don’t have too many primary colors.
- Every code editor has a huge number of color schemes to choose from.
- These schemes are usually carefully designed rather than randomly generated.
- Many schemes meet certain accessibility requirements.
- You can experience the effect of these schemes right in the code editor.
- Provide a sense of visual unity with one’s daily workflow.
The only concern is the copyright issue. Although colors themselves are not protected by copyright (at least as far as I know), to avoid unnecessary trouble, one should try to use schemes that are explicitly licensed for use.
How to Evaluate
How to Evaluate
Palette Tester is a tool for testing the contrast of a color scheme. It can test contrast under WCAG 2.1 (AA) or APCA Contrast standards. Coloring for Colorblindness and Who Can Use are two tools for testing the colorblind-friendliness of colors. They can show how the same set of colors appears to people with different types of color blindness.
My Choice
My Choice
I have always used the Modus Themes color scheme in Emacs. Coincidentally, this color scheme was designed with accessibility in mind, achieving the WCAG AAA standard, and provides variants friendly to two types of color blindness (deuteranopia and tritanopia). The color scheme of the webpage you are currently viewing comes from the tinted variant of Modus Themes.
PostGödel’s β Function [0001]
- September 22, 2023
PostGödel’s β Function [0001]
- September 22, 2023
Today in the Introduction to Recursion Theory course I was told about Gödel’s β Function, which makes it possible to encode a finite sequence into a single natural number.
The Definition
The Definition
Before the function it self, there are some auxiliary functions that need to be defined.
First we come up with the quotient and remainder functions. For all , let and be the quotient and remainder of divided by , respectively, if , and otherwise.
Then follows the (floored) square root and exceedence functions. For all , let be the largest number that , and .
Now comes the and functions, named after what Gödel named them. Let , and . The definitions may seems weird at first glance, but they would soon show their power. And they have great properties: for all , and . The proof goes as follows.
For that property of and , it suffices to show that , and this can be brought out by the fact that
That property of and is also easy following similar approach. These two properties means that the arguments of can be extracted from the result of it, and that means is an 1-1 function.
Finally, the Gödel’s β function is defined by . (Note that this is not the original definition (3-ary) but a simplified 2-ary one.) The definition is also a bit of complicated, but the following lemma tells us about why it is amazing.
Gödel’s β Function Lemma
Gödel’s β Function Lemma
For all , there exists a such that
for all .
And the the proof entails an algorithm to calculate such an .
Before the proof, we need to prove two preliminary propositions.
Bézout’s Lemma
Bézout’s Lemma
(Note that this lemma is a weaken version of the original theorem.)
If and they are coprime, then for some integers and .
Proof: Let , i.e. the set of all positive (integral) linear composition of and . Thus there must be a minimum value for this non-empty set (the non-emptiness is trivial). What this proof wants to show is that . We prove this by contradiction. Assume that . Take , let , we have . And since and are both (integral) linear composition of and , so must be , otherwise it contradicts with the minimality of . Then we have for all . Note that and , so is a common divisor of and , which leads to the contradiction toward the coprimality of and if .
Chinese Remainder Theorem
Chinese Remainder Theorem
For all , if are pairwise coprime and for all , then there exists a such that for all .
Proof: For each , let . Since are pairwise coprime, and are coprime. By Bézout’s Lemma, there are integers and such that . The insight here is that for each , we construct the number that its remainder divided by is , and compose these constructed numbers in a way that they won’t affect each other. Note that cannot be divided by , can be divided by for any where , and there is an on the right hand side of the equation we got from the Bézout’s Lemma. It is easy to see that, now it suffices to take
where is any natural number such that .
The Proof of Gödel’s β Function Lemma
The Proof of Gödel’s β Function Lemma
Finally we come to the proof of the lemma. From the definition of and , we can see that we only need to find a proper value of such that the numbers for each coprime, then construct the value of by Chinese Remainder Theorem, and calculate the . For convenience, denote by for each .
What conditions should the value of satisfy? First, it must make , which is one of the conditions asked by Chinese Remainder Theorem. Second, it makes those ‘s pairwise coprime. To prove propositions like ‘there is no prime such that and for different ‘, consider proof by contradiction. Think about what if there is some prime such that and for different , i.e. and . Assume without loss of generality, we have . It will be good if we have , which would lead to the contradiction that . So things become evident: find a construction of such that . This can be achived by making divisible by the product of all the possible values of , which ranges from to . This is to say, making would be a good idea. With the first condition that should satisfy, it suffices to take , where . I take instead of there for better elegance with the same effect.
The above is not a strictly stated proof, however it is easy to rewrite it into one.
Mumbles (Again)
Mumbles (Again)
The reason I write this post is not that the ability of Gödel’s β Function to encode a finite sequence into a number is amazing (there are many other techniques to achive this, e.g. encode the sequence into the exponents of an initial segment of primes), nor that the proof is elegant (though it is). It is just because I recalled the confusion that those two preliminary propositions caused to me, and realized that they seems easy for me now, and can be used to prove such lemmas. This feels strange, so I decided to write it down.