shell 文本文件的倒数行(尾部几行)

tail -n 3 file 显示文件内容的最后3行

  • -n <行数> 显示文件的尾部 n 行内容

tail 命令更多选项

  • -f 循环读取
  • -q 不显示处理信息
  • -v 显示详细的处理信息
  • -c<数目> 显示的字节数
  • –pid=PID 与-f合用,表示在进程ID,PID死掉之后结束
  • -q, –quiet, –silent 从不输出给出文件名的首部
  • -s, –sleep-interval=S 与-f合用,表示在每次反复的间隔休眠S秒

macOS 如何关闭自启动的后台服务进程

删除如下三个目录中的 .plist 文件,或转移到一个备份文件夹里。

  • ~/Library/LaunchAgents/
  • ~/Library/LaunchAgents/
  • ~/Library/LaunchDaemons/

Quote from ravbug.com:

OS to automatically run and re-launch headless background processes.
There are at minimum three such folders on macOS. They are: /Library/LaunchAgents, ~/Library/LaunchAgents/, and /Library/LaunchDaemons

Python ed25519 to curve25519

使用 PyNaCl 这个库:pip install PyNaCl

import nacl.bindings

# ed25519 to curve25519
curve25519_key = nacl.bindings.crypto_sign_ed25519_sk_to_curve25519(private_key)

# scalar multiplication: curve25519_key * public
pin_key = nacl.bindings.crypto_scalarmult(curve25519_key, pin_token_bytes)

macOS 如何截图?系统快捷键与应用推荐

嗨,我是芦苇Z。本文是 macOS 新手入门系列。

今天聊聊几乎每个 Mac 用户都会用到的一个功能——截图。不管是分享有趣的内容、保存重要信息,还是向朋友求助 Macbook 电脑问题,截图都是个超实用的技能。
首选的是系统自带的截图功能,然后分享了 3 款可免费使用的第三方截图应用。

Python 格式化数字之千分位

'{:,}'.format(value)  # For Python ≥2.7
f'{value:,}'          # For Python ≥3.6
import locale
locale.setlocale(locale.LC_ALL, '')  #  '' 空字符自动选择, 或者指定,例如 'en_US.UTF-8'

'{:n}'.format(value)  # For Python ≥2.7
f'{value:n}'          # For Python ≥3.6

参考文章

如何搜索本站文章

🔍搜索框快捷键:Ctrl + K

使用类 Unix 搜索命令语法。
例如搜索包含 helloworld 的文章:'hello 'world

语法详情:

  • 空格充当**逻辑与(AND)**操作符,
  • 竖线(|)字符充当**逻辑或(OR)**操作符。
    要搜索空白(转义空白)请使用双引号。举例:'"hello world",用于搜索包含“hello world” 的文章。
语法示例 匹配类型 说明
jscript 模糊匹配 Items that fuzzy match jscript
=scheme 精确匹配 Items that are scheme
'python 包含 Items that include python
!ruby 不包含 Items that do not include ruby
^java 以指定字符开头的 java 开头的内容
!^earlang 不以指定字符开头的 不以 earlang 开头的内容
.js$ 以某字符结尾的 .js 结尾的内容
!.go$ 不以某字符结尾的 不以 .go 结尾的内容