A Journal Through My Activities, Thoughts, and Notes
死亡是一种程序,它是写在基因里的。
#网友语录
为什么还不下班?
我这么有效率的人应该每天只上半天班
除了我谁能边打游戏边三天写一万字
三名宇航员在缺氧缺水的情况下穿越荒凉的太空,向地球飞行。或许有一天这个故事会成为寓言:地球也是一艘旋转的宇宙航天器,我们都是宇航员,我们的氧气和水也在减少,但是我们无处可去。

#阿波罗13号生还实录
#网友语录
@larryshen
幸福的关键不在于陪伴时间多寡,而在于陪伴质量高低。当我们完全不想改变对方时,才可能真正陪伴对方。
我的自行车已经骑了6年多,自从上次给链条上油之后滑轮滑的分外厉害,每次骑都要小心翼翼的均匀用力,怎么也调不好。恐怕链条和飞轮都该换了。

于是最近两天都在骑Eric的自行车上班,反正他也不骑。很好骑呢!看来买新自行车的计划又可以放放了。
#网友语录
家里两台 #Mac 经常要互传文件,隔空投送和系统自带的网络功能经常会找不到对方,最近发现 LocalSend 真不错,基本上完美地解决了我局域网内互传文件的需求,而且还是免费的: localsend.org 👍
#网友语录

愿我活的足够久。
愿我永不设限。
愿我永远拥有好奇心。
好好的去感受这个世界。🥹
明朝末年,经常有地方知县知府不给明军开门,因为明军进城后的烧杀劫掠一点儿不比李自成少。比如持尚方宝剑督师的大学士李建泰,从北京出发领兵迎击李自成,这一路就没有地方官敢给他的明军开门,气的这位大学士还没到保定呢就带着明军攻破了两个县城了……

#网摘
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.
Back to Top