家里的笔记本电脑

记录一下。

牌子型号内存CPUOS
MacBook AirA14664G4 Intel(R) Core(TM) i5-3427U CPU @ 1.80GHzXubuntu 22.04
MacBook ProA15028GmacOS Big Sur
Lenovo Yoga16GRyzen 5 4600UWindows 11 Prof
ThinkPad10GXubuntu 22.04

只能做文字工作了。或许去买个Redmi Book?

MC multiple-cursors

最近有看tsoding的写代码直播,他是用emacs的。其中看他处理多列编辑很熟练,就去查了一下,估计他是使用multiple-cursors这个插件。就在自己的配置里面添加了几行快捷键,方便自己。

(global-set-key (kbd “C-S-c C-S-c”) ‘mc/edit-lines)
(global-set-key (kbd “C->”) ‘mc/mark-next-like-this)
(global-set-key (kbd “C-<“) ‘mc/mark-previous-like-this)
(global-set-key (kbd “C-c C-<“) ‘mc/mark-all-like-this)

内核恐慌和吴涛的博客

内核恐慌是个面向程序员的播客节目。前面一些比较好听,后来就更新得少了,以至于是年更节目了。

最近好像有个什么播客活动,各种个样的电台在窜台。内核恐慌的两个主播Rio和吴涛就到枫言枫语去合作了一期节目叫 《如果不做程序员我们会做什么?》。

由于多年都在听内核恐慌,所以这期的内容倒是了无新意。里面提到了主持人吴涛的博客,还给了链接,很有意思。

吴涛的博客写了好几年,近几年不写了。我曾经看过,记忆里觉得都是一个个标题问题,然后就是个简单的回答,今天再去回顾,发现还真的写了不少文字在里面。

其实无论文字长短,都是那一刻的思绪,值得记录下来。

Datasette SQLite

有一两年了,在油管上看到一个pycon的演讲,主题是 https://datasette.io ,作者是Simon Willison。datasette是一个Python的包,也是一个数据展示的生态。可以通过pip install datasette 来安装。

这个工具的的核心是在浏览器里展示sqlite数据库文件的内容。

为什么要用sqlite呢?sqlite作为一个文件数据库,在互联网上的应用处理并发是不合适的,但是,作为一个只读的内容承载,是非常好的。有两篇参考文档可以看:

https://simonwillison.net/2021/Jul/28/baked-data/
https://mozilla.github.io/meao/2018/03/28/bedrock-the-sqlitening/

最近,在阮一峰的网摘上,也收录里一篇SQLite背后的故事,很有趣。

https://liyafu.com/2022-07-31-sqlite-untold-story/

文摘链接在这里:

https://www.ruanyifeng.com/blog/2022/08/weekly-issue-217.html

可以好好研究一下这两个工具,挖掘一下。

大脑经常短路

最近真的脑子容易短路,思路很不清晰。

我的电脑不新,工具链就比较老。比如我的.NET工具就是用SharpDevelop,一个已经死掉的IDE。

这两天我想用它写一个简单的桌面程序,就连一个本地的Postgres数据库。

我查了网上,需要用到Npgsql这个包,但是版本就很高,比我电脑上的.NET框架要高。我就磨了好几个小时,白白浪费了。

后来我看着天花板,想着,其实最简单的就是更新我的工具链,不用SharpDevelop了,这样问题就解决了呗。

我真的要在思路上向前看,用新技术,用更好的工具。那时,问题要么解决,至少遇见的问题也会上一次档次。

不是年终总结

翻进来第一件事就是加了一个副标题,“年更节目”。

工作换了一个,到一个比较远的地方工作。早上有班车,晚上没有,自己坐一个半小时的地铁回家。

并没有戒掉看台湾节目的兴趣,这个是不是要放到2022的resolution里还没有下定决心。

听了不少播客,从不同的平台,小宇宙、喜马拉雅、CastBox、Overcast。总结下来就是听听声音就好了,不要去强求脸。

社交网络玩得很多,饭否开始了先审后显示,也是一种自保。不过现在对饭否的依赖度倒是降下来了,要做好备份。长毛象也玩起来了,其实吧,长毛象虽然是分布式的,但是也要依附在具体的实例上,不能永存。豆瓣就标记一下看了什么读了什么,没有好好经营。费老的豆瓣账号被停了,不能读不能写,反正就是环境不好呗。最近两个月倒是看起了小红书。小红书提供了一种不同于抖音快手的选择,可以不看视频只读图文帖子。现在小红书的算法已经非常按照我的兴趣推荐了。

每周五都会早上看阮一峰的网摘,随便看看,也没有转化成什么。

换了一个小房子,没有房租了,安心了一些。但是也需要打理。还是要喊安得广厦千万间。

还是买了新的周历本,无印良品的本子从12月份开始,我已经陆陆续续记了一个月,感觉不错。

不说了,琦姐要来看了。(12月31日下午三点左右吧)

2022年目标以平稳为主吧。

Org Mode的Refile功能

在Org Mode中经常会遇见org-refile这个命令。我这么多年一直不知道这个命令是干什么用的。最近重新捡起来用orgmode来管理自己的GTD事项,不自主的就捡起Org Mode – Organize Your Life In Plain Text! 这篇文章,想根据这篇文件来调整自己的GTD流程。

这篇文章里就谈到了org-refile这个命令,我终于明白这个命令就是方便的把一个节点移动到另一个节点下面的命令,快捷键是C-c C-w。但是这个命令有很大的灵活度,在默认的情况下它只能把当前的节点移动到当前文件的第一级节点下面。如果需要更灵活,那么要进行一些配置:

(setq org-refile-targets '((nil . (:level . 3))(org-agenda-files :maxlevel . 3)))

这句话的意思就是把org-refile命令的目标设置成当前文件和所有org-agenda文件的三个级别以内。这样在按了C-c C-w(或者 M-x org-refile)命令时候,在mini buffer里会列出来可以移动到的所有目标位置,用上下键可以选择,回车确定,就移动过去了。这样的好处是我们不用像操作文本一样拷贝粘贴,减少了错误率。

其实很简单。但是在我的实践中,我是用org-refile命令来归档的。然而,在上面的文章里,作者的GTD的操作是另外一种。就是他用org-capture命令把待办事项先简单地添到一个池子里,然后再把相应的todo项用org-refile命令移动到特别的项目文件里去。这是和我相反的一个思路,但是更合理。所以我也配置了<f9>-c作为我的org-capture命令进行快速的添加待办事项,然后再移动到不同的项目文件中。

简单记一笔,不断改进自己的工作流程。

投奔Prelude

好久以来我就是个Emacs用户,但是并不坚定。各种编辑器中都用用,有的时候为了一个特定的功能就会打开Sublime Text。现在我的电脑里装了Emacs、GVim、Sublime Text、VSCode、UltraEdit,这么多编辑器,还不算上PyCharm、IntelliJ一类的IDE。

Emacs和Vim的圣战中我一直站在Emacs一边,多年来也捅咕着自己的配置文件。有一年多,我是在用Spacemacs的,但是我的观念就是绝对不会设置成Vim模式。后来又听说了Doom Emacs,虽然说快一些,但是默认的Vim模式我也是很不喜欢。我喜欢那种按住CTRL键天花乱坠的章鱼感觉。

还有一点,在不同的配置之间切换也是我一直头疼的事情。既然Spacemacs、Doom Emacs只是GNU Emacs配合的一套配置文件,那应该有办法把它们装在不同的目录下,然后用脚本进行切换的。

这个礼拜在RSS上看到https://emacsredux.com/blog/2020/09/15/emacs-prelude-1-0/ 这一篇,原来Prelude终于升级到1.0啦。其中有一句话特别中我的意:

Prelude aims to enhance the classic Emacs experience without deviating a lot from it – e.g. it would never enable something like evil-mode (vim keybindings) by default and so on.

对吗,这才是Emacs该有的样子。Spacemacs还是Emacs吗?好怀疑。文档里有安装方法,可以把这套配置文件安装到一个制定的地方。

$ export PRELUDE_INSTALL_DIR="$HOME/.prelude.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh

这样就行了。感觉上就是一个增强版的Vanilla Emacs啦。

后面一个多配置共享的问题,我在StackOverflow上搜到一个答案。https://emacs.stackexchange.com/a/44678,安装一个叫chemacs的工具。

$ git clone https://github.com/plexus/chemacs.git
$ cd chemacs
$ ./install.sh

然后在自己的家目录维护一个 .emacs-profiles.el 文件。在里面列举你的配置。

(("prelude" . ((user-emacs-directory . "~/.prelude.emacs.d")))
 ("spacemacs" . ((user-emacs-directory . "~/spacemacs"))))

最后就可以用相应的配置来启动Emacs啦。

$ emacs --with-profile prelude
$ emacs --with-profile spacemacs 

这样在保留Spacemacs的情况下又可以用Prelude了,很好。

YMCA Song

Young man, there’s no need to feel down
I said, young man, pick yourself off the ground
I said, young man, ’cause you’re in a new town 
There’s no need to be unhappy
Young man, there’s a place you can go
I said, young man, when you’re short on your dough
You can stay there, and I’m sure you will find 
Many ways to have a good time
It’s fun to stay at the YMCA
It’s fun to stay at the YMCA
They have everything for you men to enjoy
You can hang out with all the boys
It’s fun to stay at the YMCA
It’s fun to stay at the YMCA
You can get yourself clean, you can have a good meal
You can do what ever you feel 
Young man, are you listening to me? 
I said, young man, what do you want to be? 
I said, young man, you can make real your dreams
But you got to know this one thing
No man does it all by himself
I said, young man, put your pride on the shelf
And just go there, to the YMCA
I’m sure they can help you today
It’s fun to stay at the YMCA
It’s fun to stay at the YMCA
They have everything for you men to enjoy
You can hang out with all the boys 
It’s fun to stay at the YMCA
It’s fun to stay at the YMCA
You can get yourself clean, you can have a good meal 
You can do what ever you feel 
Young man, I was once in your shoes
I said, I was down and out with the blues
I felt no man cared if I were alive
I felt the whole world was so tight 
That’s when someone came up to me
And said, young man, take a walk up the street
There’s a place there called the YMCA
They can start you back on your way
It’s fun to stay at the YMCA
It’s fun to stay at the YMCA
They have everything for you men to enjoy
You can hang out with all the boys 
YMCA, it’s fun to stay at the YMCA
Young man, young man, there’s no need to feel down
Young man, young man, pick yourself off the ground
YMCA, it’s fun to stay at the YMCA
Young man, young man, are you listening to me
Young man, young man, what do you wanna be?
YMCA, you’ll find it at the YMCA
No man, young man, does it all by himself
Young man, young man, put your pride on the shelf
YMCA, and just go to the YMCA
Young man, young man I was once in your shoes
Young man, young man I was down with the blues, YMCA

欢乐颂

欢乐女神圣洁美丽
灿烂光芒照大地!
我们心中充满热情
来到你的圣殿里!
你的力量能使人们
消除一切分歧,
在你光辉照耀下面
四海之内皆成兄弟。