A Journal Through My Activities, Thoughts, and Notes
The text in @413 (How to stay calm) is from a picture I stole on the internet, it is surprisingly popular. More than a hundred people retweeted it on mastodon. I learnt a lot of people want to be clam in this busy world.
#How To Stay Calm (without any hacks)

Overthinking → Write
Uninspired → Read
Scared → Take a risk
Stuck → Walk
Tired → Sleep
Confused → Ask
Frustrated → Move
Burned out → Take a day off
Impatient → Review progress
Unmotivated → Remember your "why"
In #WinForms (and more generally in many Windows applications), the & character has a special meaning when used in a button's text. It is used to define an access key or mnemonic for the button. When you use & in the text of a button, it allows you to specify a keyboard shortcut that activates the button when the user presses the Alt key along with the corresponding letter.Here's how it works:Single Ampersand &): It creates a mnemonic. For example, if you set a button's text to "Save &File", the F in "File" will be underlined, and the user can press Alt + F to activate the button.Double Ampersand (&&): It is used to display a single & character in the text. This is useful if you want to include an actual & character in the button text but don’t want it to be treated as a mnemonic. For example, if you set the text to "Save && Exit", the button text will display as "Save & Exit", with only the & in "Exit" being treated as a mnemonic.
#网友语录
我怀疑,有没有可能,虽然柏林墙是 1989 年倒塌的,但是 1961 年,东德为了防止东德人逃到西德而修建柏林墙,胜负就已经清楚了?
#idea #comment
其实我已经变相实现了评论功能。只要@407 (打算评论的笔记编号),这篇笔记就会出现在那条笔记的下方(Linked Notes)
我们这边天暖和了,散步就经常能看到有人把heater扔在路边等人捡。挺好的heater呢!但我自己家已经买了三个。每次我要伸手都被太太叫停,虽然内心仍觉得可惜,但我知道太太是对的:捡回来也是扔在车库里,不如留给真正需要的人。我们都经历过匮乏,都有捡东西的冲动。总有那种想法,虽然现在用不上,但说不准啥时候就用上了。然而这些捡来一时用不上的东西也是负担,不仅仅是占地方,也占用我们宝贵的时间。
只要好好爱自己,想玩就去玩,想学去就去学。把自己的时间有效的利用好,就不仅仅会产出成果,而且会产出魅力。
把时间用在你最终不会引以为豪的东西上面,是一件可怕的事情,浪费了你在地球上的短暂旅程。

#网摘
#书摘 #费曼语录

米歇尔这样写道:我记得我从我父亲那里得到了很多建议:思考一个数学问题,看看你的答案是否有道理。与人交流,要努力直接而诚实。要友好而和气。要明白生活是一次令人兴奋的探险。找到某种你喜欢的事情去做。事事要卖力。永远,永远记住你的感觉和幽默!我不总是能嘲笑我自己,但这是我父亲擅长的事。
#grep #tips

## Basic Regular Expressions (BRE)

Basic Regular Expressions are the default regular expression syntax used by grep when no special options are provided. BRE uses a more limited set of metacharacters compared to Extended Regular Expressions (ERE).

Some key points about BRE:

- Metacharacters like +, ?, |, (, ) are treated as literal characters and need to be escaped with a backslash (\) to use their special meaning.

- The $$ and $$ constructs are used for grouping in BRE, instead of just ( and ) as in ERE.

- Alternation is done using \| instead of just |.

- Repetition operators like * and \{n,m\} are used to match zero or more and ranges of repetitions respectively.

For example, to match lines containing either "cat" or "dog" using BRE:

grep 'cat\|dog' filename


And to match lines with 3 to 6 digits:

grep '\([0-9]\{3,6\}\)' filename


The backslashes are necessary to use the grouping and repetition metacharacters in BRE syntax.

So in summary, BRE provides a more limited set of regex features compared to ERE, but is still very powerful for common text matching tasks. The main difference is the need to escape certain metacharacters in BRE.

One thing I would to mention here is that most metacharacters in Basic Regular Expressions (BRE) need to be escaped, but the * character does not. This might seem inconsistent, but it's due to historical reasons and the way BRE was designed.

### Historical Context

In the early days of Unix, the grep command was developed, and it used BRE as its default syntax. At that time, the * character was already a special character in many programming languages and shell scripts, often used for wildcard matching. To avoid conflicts and make BRE more intuitive for users familiar with shell globbing, the designers of grep decided to treat the * character as a special character without needing an escape.

### Why Not Escape *?

Escaping every special character would make BRE more verbose and less readable, especially for simple patterns. By treating * as a special character without an escape, it simplifies common tasks like matching any number of characters (including zero) before or after another character.

### Example

For instance, to match any number of characters before or after a specific string, you can use:

grep 'pattern*' filename


This will match any line containing "pattern" followed by zero or more characters.

### Summary

While most metacharacters in BRE require escaping, the * character is an exception due to its historical significance and the desire to keep BRE syntax simple and intuitive. This makes it easier for users to learn and use basic regular expressions without needing to worry about escaping every special character.
#网友语录

很多人看到国足踢日本零比七惨败,就想与之切割?其实我们就是国足,国足就是我们,国足的问题就是我们的问题,我们的问题就是国足的问题……

中华民族是一个勤于反省但“这个我们可改变不了”的民族。
#网友语录 #jessie

Some tests just make sure the happy path works, but good tests make sure the failure cases fail in the way you expect AND that any engineer who comes into the codebase after you will not fuck up your functionality with zero context of it because if they do, tests will fail.
#读完了

读完了《费曼手札—不休止的鼓声》。读费曼的信真是一种享受。By the way, 他真是写拒绝信的高手,而且绝对不会让被拒绝的人难过!
#网友语录
说起来我在澳洲的第一个困惑经历就来自这方面。

那天老师问:在中国,你生病了是去医院还是去看医生。

我心里想:这不是一回事吗?
老师心里想:看起来她没有听懂我的问题,我换个说法试试。
😂

解释:在澳洲和新西兰,看医生是指看社区诊所的全科医生,要先预约,要付诊费,但等待时间短。去医院一般是去急诊。比如全科医生已经下班了,这时候就要去医院。医院分公立和私立。公立不要钱,但通常要排队排很久,非紧急病情排几个小时很正常。还有一种是24hours诊所,非工签,非PR,非公民有紧急情况,一般只能去24Hours诊所,收费相对贵(以基督城为例,普通诊所$54一次,但24Hours要$170一次)。
前几天婉拒了一个机会,因为问过了自己的内心,并不想更换赛道,虽然那个赛道我很喜欢玩。我更满足现在的生活,担心以那个方向为业会挤掉我的业余项目,也担心会毁掉我对它本来的兴趣。

年岁渐长就会变得保守?并不。我问过自己的内心了,就是不想要。
#网友语录 #非洲

1880 年代后,欧洲列强加速了对非洲大陆的瓜分,几乎将整个非洲划分完毕。只有埃塞俄比亚 Ethiopia 和利比里亚 Liberia 成功保持了独立。埃塞俄比亚以其强大的军事实力和坚强的民族意识抵抗了意大利的侵略,地形险峻和复杂的气候也阻碍了外军的入侵。埃塞俄比亚的地图离远了乍一看像是临海,但其实一点都没有,它是全球人口最多的内陆国家,有一亿人口。早期基督教从公元 1 世纪开始就已经在埃塞俄比亚传播了,现在国民大多数信仰基督教。埃塞俄比亚还是咖啡的原产地。利比里亚创立的初衷是为被解放的黑人提供一个新的定居地,受到了美国的庇护,得以避免被欧洲列强吞并,但其独立地位仍依赖于美国的保护,因为其国力相对较弱。Liberia 得名于自由 liberty 和解放 liberation,国旗和宪法仿效美国,首都蒙罗维亚 Monrovia 纪念的是美国总统 James Monroe。利比里亚的官方语言是英语,我好几次在博洛尼亚搭讪到说英语的非洲人都是利比里亚来的。
#grep #tips
The -o option in grep stands for "only matching." When this option is used, grep will print only the parts of the lines that match the specified pattern, rather than the entire line. This is particularly useful when you want to extract specific substrings from lines of text.

The -E option in grep enables the use of Extended Regular Expressions (ERE) in the pattern. This allows for more powerful and flexible pattern matching compared to basic regular expressions (BRE), which is the default behavior of grep.

### Key Differences with Extended Regular Expressions

When using -E, you can utilize additional metacharacters and constructs that are not available in basic regular expressions. Here are some of the key features of ERE:

1. Metacharacters: In ERE, the following metacharacters are treated as special without needing to be escaped:
- + : Matches one or more occurrences of the preceding element.
- ? : Matches zero or one occurrence of the preceding element.
- | : Acts as a logical OR between expressions.
- () : Groups patterns for applying quantifiers or for alternation.

2. Example Usage:
- To match either "cat" or "dog", you can use:
     grep -E "cat|dog" filename


- To match one or more digits, you can use:
     grep -E "[0-9]+"


3. Combining with Other Options: You can combine -E with other options like -i for case insensitivity or -o to print only the matching parts:
   grep -Eio "cat|dog" filename
把nginx部分挪出来整了一个单独的仓库。responsive-image-server
#macos #rustdesk
For people experiencing this problem, if you have SSH access to the mac in question, the caffeinate command can be used to wake the machine and allow RustDesk connectivity; e.g. caffeinate -u -t 2.
Back to Top