GPG key for SSH authentication

Using GPG key for ssh authentication reduces the effort involved in managing SSH keys, which is the main reason I want to learn this technique. GPG key for all (not just one GPG key possibly).

2023-11-28

SSH notes

SSH 是一个我之前就想尝试使用的工具,当时只有对它的一个很简单的印象,就是可以通过它安全的访问另外一台电脑——的 Terminal。当然对它的具体原理和运行逻辑肯定是不了解的,包括它是怎么个安全法。只知道哦我可以通过它访问到比如说,当我自己打开 Terminal 时候首先展示在我面前的那一堆东西,其实就是在 $HOME directory 你输入比如 ls -al 命令出现的各个 directory。只是我可以看到另一台设备的这一堆东西。那当时这个需求也是没有那么强烈,所以就还是暂时搁置没有了解。 ...

2023-11-28

File size

Notes du * 输出的其实不是我们通常理解上的文件大小,而是所谓 block size(block count 可能更准确)。而且,它显示的是 disk usage,也就是这个文件占了多大的硬盘容量,或者说文件系统实际分配了多少空间给到这个文件。而不是,这个文件,它本身有多大。这个区别比较关键,后面会有更多的说明。 $ du * 5568 1-2-1_2frames_ap4h.mov 8040 1-2-1_2frames_ap4x.mov 3928 1-2-1_2frames_apch.mov 2152 1-2-1_2frames_apcn.mov 688 1-2-1_2frames_apco.mov 1592 1-2-1_2frames_apcs.mov 我们使用 exa 这个 ls 的替代,用 exa -lh -b -S 这个命令得到这样的输出: $ exa -lh -b -S Permissions Size Blocks User Date Modified Name .rw-r--r--@ 2.7Mi 5568 thom 27 Oct 17:32 1-2-1_2frames_ap4h.mov .rw-r--r--@ 3.9Mi 8040 thom 27 Oct 17:32 1-2-1_2frames_ap4x.mov .rw-r--r--@ 1.9Mi 3928 thom 27 Oct 17:32 1-2-1_2frames_apch.mov .rw-r--r--@ 1.0Mi 2152 thom 27 Oct 17:32 1-2-1_2frames_apcn.mov .rw-r--r--@ 342Ki 688 thom 27 Oct 17:32 1-2-1_2frames_apco.mov .rw-r--r--@ 793Ki 1592 thom 27 Oct 17:32 1-2-1_2frames_apcs.mov -l: Display extended file metadata as a table. -h: Add a header row to each column. -b: List file sizes with binary prefixes. --binary. -S: List each file’s number of file system blocks. 可以看到 Blocks 那一栏跟 du * 的输出是一样的。-S 的 flag 的作用也正是列出 file system blocks。 ...

2023-11-01

C++ Preprocessor

Excerpted from learncpp.com preprocessor .cpp file => preprocessor: Make change to the text of the code file, but not actually to the original code file, rather temporarily in-memory or using temporary files. Uninteresting things: strip out comments, ensures each code file ends in a newline. One important role: process#include directives. => What comes out of the preprocessor is called translation unit. The translation unit is then compiled by the compiler. The entire process of preprocessing, compiling and linking is called translation. ...

2023-09-21

Parse QuickTime File Format

Apple Developer Documentation Storing and sharing media with QuickTime files Color parameter atom (‘colr’) Uncompressed Y´CbCr Video in QuickTime Files — Documentation Archive Other resources Apple ProRes - MultiMedia Wiki QuickTime Tags - ExifTool MPEG-4 files - Atomic Parsley MP4RA - Official Registration Authority for the ISOBMFF family of standards Implementations/tools Implementations Language Notes metacolor.editor C# Simple Implementation, can only change NCLC tags. Provide GUI. qtff-parameter-editor C++ Good implementation, can only change NCLC tags. CLI. AMCDXVideoPatcherCLI C++ Close source. Can modify colr atom, add gama atom (but value of gamma can’t not be changed — seems a bug) qtfile_pp C++ AMCDXVideoPatcherCLI 作者的开源 parser,想必 AMCDXVideoPatcherCLI 的具体实现能够从这里看出一些端倪 dryv Rust No docs bento4 C++ 最完善 Inspection tools hexdump -vC fq MP4Box.js - a file inspection tool mp4analyser Notes 这么些处理 atom (包括 NCLC tag) 的实现,都是用 C++ 写的。其实 Rust 也能做这些 low-level 的事情,对吗?只是这门语言比较新,暂时还没有人用它来做这个事而已。那么我能不能来做呢?用 Rust 写一个 parse MOV file format 的实现。其实已经有了:dryv——这两天就在更新。 ...

2023-09-18

Machine Learning Glossary

Reference Machine Learning Glossary - Google for Developers activation function A function that enables neural networks to learn non-linear (complex) relationships between features and the label. Popupar activation functions include: ReLU Sigmoid Tanh backpropagation The algorithm that implements gradient descent in neural networks. Training a neural network involves many iterations of the following two-pass cycle: During the forward pass, the system processes a batch of examples to yild prediction(s). The system compares each prediction to each label value. The difference between the prediction and the lable value is the loss for that example. The system aggregates the losses for all the examples to compute the total loss for the current batch. During the backward pass (backpropagation), the system reduces loss by adjusting the weights of all the neurons in all the hidden layer(s). Neural networks often contain many neurons across many hidden layers. Each of those neurons contribute to the overall loss in difference ways. Backpropagation determines whether to increase or decrease the weights applied to particular neurons. ...

2023-09-07

Calculus Recap

Intermediate Value Theorem (IVT) If a function $f(x)$ is continuous on a closed interval $[a, b]$ and $k$ is any number between $f(a)$ and $f(b)$, then there is at least one number $c$ in the interval $[a, b]$ such that $f( c) = k$. The intermediate value theorem has two conditions: Function $f$ is continuous over the interval $[a, b]$. The value $d$ lies between $f(a)$ and $f(b)$ We must establish these two conditions to conclude that there is a value $c$ in the interval $[a, b]$ for which $g(x) = d$ (another way to phrase this conclusion is that the equation $g(x) = d$ has a solution where $a <= x <= b$). ...

2023-08-30

Give Up Vim

为什么从 Vim 切换回普通 Cursor Obsidian 用的就不是 Vim 模式。因为我需要在 Obsidian 输入中文,中文输入之下,Vim 完全是不可用的状态。我也不想去折腾怎么让 Vim 的模态切换在中文输入下也可用(应该是有这样的解决方案的)。 其他地方,各种输入框:浏览器、Raycast、ChatGPT,包括网页的全局搜索框(Cmd+F),都不是工作在 Vim 的模式下(确实曾经也尝试过把浏览器也用 Vim keybind 来操作…)。而在这些场景下使用普通的 Cursor 移动方式对我来说也已经非常熟练和习惯了。也觉得 Cmd ← 和 Cmd → 回到行首行尾和 Opt ←, Opt → (上一个词/下一个词)蛮好用的。 我对在 Insert mode 和 Normal mode 之间切换感到疲倦。使用 Normal cursor 的话,就一个模式我想什么时候移动就什么时候移动。用 Vim 我还需要从 Insert mode 切换出来。而且我使用的退出 Insert mode 的 keybind 是 jk,而不是 Esc。之前觉得 Esc 在键盘的位置,还是会让手的 movement 太大。jk 直接就在 hjkl 下,手臂不需要移动,非常方便。但现在觉得 jk 都麻烦,尤其在模态之间切换频繁的话,一会儿就得 jk 来一下,非常繁琐——繁琐是因为模态的切换,而不是换个 keybind 就能解决的。所以我选择不要这些模态。 在 PyCharm 的 Completion 之间选择 Candidates,有时需要上下移动选择那个我想要的。之前想把它们 bind 到 hjkl 上,但怎么都找不到办法,只有使用上下键。在 Vim 原教旨主义者看来很不 ok 是吧,但我当时忍了下来。现在想既然如此,为啥不直接全换到 Normal keybind。我知道是可以直接用 Emacs 的 keybind Ctrl n 和 Ctrl p 来上下选择,但。 ...

2023-07-09

DEVONthink 上手

我主要用 DEVONthink 来管理我的 PDF 文档。那事情最初呢,是因为我想找一个 PDF 阅读器。首先考虑的自然是 PDF Expert,然后是 Adobe Acrobat Reader。PDF Expert 我以前在 Mac 上试用过,功能很简单,就是一个纯粹的 PDF 阅读器,可以标注划线啥的,能满足我基本需要。但它是订阅制,每年 79.9 刀,也不便宜。况且我也不太喜欢订阅制。想着数码荔枝有没有代理 PDF Expert 在国内的销售?这样兴许能便宜好多。但没有。Adobe Acrobat Reader 呢,下载玩了一下,印象不怎么好。再加上我对 Adobe 的软件都不怎么喜欢,印象都不怎么好(Creative Cloud 那一大坨东西啊……看着就头疼),这个 Acrobat 也赶紧卸载了。 那么回过来一想,PDF 阅读器,macOS 自带的不能用吗?我也试了下,作为正经的主力的 PDF 阅读器,我还是别为难自己了。人那个系统自带的 Preview 啊,苹果一贯的所谓简洁设计,我要用的功能找半天也找不到(还是没有?不知道)。我还是放自己一马吧。 DEVONthink,这个软件呢,以前就有所耳闻。估计还是 2016、2017 年那会儿,刚入坑这数码生活的时候就有听说,终极的知识管理工具。后来在环环的开箱 ARRI Mini LF 的直播录像中,有看到他也在用 DEVONthink,在开 Mini LF 的一些文档什么的。那时觉得哎他有一个地方可以放所有的 PDF 文档,想查哪个文档直接来这找就行。我当时还没有,文档都是不知道放在哪里,Google Drive 也好,MEGA Sync 也好,或者 iCloud 也有。而且,重点是 DEVONthink 它自带有 PDF 阅读器啊。这个就正合我意了,于是这才冒出念头我要实际下载来试一下。 Ok,下载安装了。这一大堆都是什么……噢看到有 Manual,还是一本…书?有提供 PDF 版本,EPUB 版本。这软件这么复杂的吗?当然我对这个复杂度也有预期,毕竟「终极知识管理工具」。那么先用起来吧。 噢它是 Database 的概念。建一个 Database,所有的东西都存到这个 Database 里,存完后 Database 之外的副本就可以删掉了。然后 DEVONthink 软件在这个 Database 里做所有的扫描和索引,从而让你可以在里面全局搜索,不止搜文档名,搜索文档的内容都行。 ...

2023-03-09

ICC Profile

对普通显示器校色的时候,很难不碰到 ICC profile 这个东西。我们都知道这个名词,显示器的 ICC 文件,或许模糊的对它有一些概念。但它究竟是什么?原理如何。 ICC profile 跟我们已经有很明确概念的 ACES,或者更广泛一些地讲:「现代的色彩管理流程」,是很相似的 idea。都有一个处于整个链路中间的非常大的色彩空间,大到足以容纳所有不同的输入、显示和输出设备的各种色域(sRGB、AdobeRGB、Rec.709 等等)1。这个色彩空间在 ICC 这个概念下叫作 PCS(Profile Connection Space)。ICC profile 通过定义设备源或目标色彩空间与 PCS 之间的映射来描述特定设备的色彩属性2。 ICC 本身并不进行任何校准,它们只包含显示器关于色彩成像能力的数据。这些数据用于帮助可以识别 ICC profile 的软件(我们叫它 ICC aware 的软件)通过 CMM(色彩管理模块)对图像进行调整,以尝试纠正显示器的色偏来进行校准。ICC profile 完成的实际上是对图像的调整,而不是对显示器的校正。不同的软件使用不同的 CMM 的话,即使都采用同一个 ICC,最终出来的结果也可能不一样。 ICC Profile - IBM ↩︎ ICC profile - Wikipedia ↩︎

2023-03-09