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秒
tail -n 3 file
显示文件内容的最后3行
-n <行数>
显示文件的尾部 n 行内容tail 命令更多选项
删除如下三个目录中的 .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
pathlib.Path.unlink()
removes a file or symbolic link.
删除单个文件或文件符号链接
os.rmdir()
或 pathlib.Path.rmdir()
removes an empty directory.
删除一个空文件夹
os.removedirs()
remove recursive empty directories
删除多层的空文件夹
shutil.rmtree()
deletes a directory and all its contents.
删除文件夹,包括其中所有子文件夹和文件
使用 PyNaCl 库:
import nacl.bindings
# scalar multiplication: curve25519_key * public
pin_key = nacl.bindings.crypto_scalarmult(curve25519_key, pin_token_bytes)
使用 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)
某个 collection 的所有 tags
{% assign tags = '' | split: ',' %}
{% for doc in collection.docs %}
{% assign tags = tags | concat: doc.tags %}
{% endfor %}
{% assign tags = tags | uniq %}
嗨,我是芦苇Z。
在 Macbook 上做设计、编辑图片或调整界面配色时,有时需要获取屏幕上某个点的颜色。今天就来聊聊 macOS 上的取色工具,如何获取屏幕上任意位置的颜色值。
嗨,我是芦苇Z。本文是 macOS 新手入门系列。
今天聊聊几乎每个 Mac 用户都会用到的一个功能——截图。不管是分享有趣的内容、保存重要信息,还是向朋友求助 Macbook 电脑问题,截图都是个超实用的技能。
首选的是系统自带的截图功能,然后分享了 3 款可免费使用的第三方截图应用。
🔍搜索框快捷键:Ctrl
+ K
使用类 Unix 搜索命令语法。
例如搜索包含 hello
和 world
的文章:'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 结尾的内容 |