ffprove 获取视频分辨率
ffprobe -v error -select_streams v:0 -show_entries stream=height,width -of csv=s=x:p=0 input.mp4
ffprobe -v error -select_streams v:0 -show_entries stream=height,width -of csv=s=x:p=0 input.mp4
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 %}
系统自带功能(使用快捷键)
· 截屏到剪切板 ⌘ + ⇧ + 3
· 截屏到文件 ⌘ + ⇧ + 4
· 截屏到文件(手动框选区域) ⌘ + ⇧ + 5
· 更多快捷键可参考 macOS 常用快捷键一览
自动自带的 “Digital Color Meter”
鼠标移到要取的颜色上,再按 Shift + Command + C 就可以复制十六进制颜色值到剪切板
Pixeur
免费。用起来更方便和舒适。
🔍搜索框快捷键: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 结尾的内容 |
用浏览器请求 REST API,发现浏览器端总是报错:no ‘Access-Control-Allow-Origin’ header。但是 Postman 里请求 API 是正常的。
这是因为浏览器跨域请求 API,发现服务器不支持 CORS。
比如在本地测试的网页地址是:
http://127.0.0.1:3000/
,该页面的 JS 请求的 API 地址是:https://xxx.execute-api.xxx.amazonaws.com/
。