切换深色模式
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
end tell
end tell| -- 数据库大小 | |
| select pg_size_pretty(pg_database_size(current_database())); | |
| -- 只计算table size | |
| select schemaname, pg_size_pretty(sum(pg_relation_size(schemaname || '.' || tablename))) from pg_tables group by schemaname; |
| export class BitReader { | |
| private offset: number = 0; | |
| private bitOffset: number = 0; | |
| private uint8Array: Uint8Array; | |
| constructor(buffer: ArrayBuffer) { | |
| this.uint8Array = new Uint8Array(buffer); | |
| } | |
| public read(length: number): number { |
| export function bubbleSort<T>(list: Array<T>, compare: (a: T, b: T) => number) { | |
| for(let i = 0, len = list.length; i < len - 1; i++) { | |
| for (let j = 0; j < len - 1 - i; j ++) { | |
| const a = list[j]; | |
| const b = list[j + 1]; | |
| if (compare(a, b) > 0) { | |
| list[j] = b; | |
| list[j + 1] = a; | |
| } | |
| } |
BFS 的重点在于队列,而 DFS 的重点在于递归。
namespace A {
export interface Node {
value: number,安装 corkscrew 软件,mac 系统可以直接使用 brew 安装
brew search corkscrew
brew install corkscrew配置 ssh,编辑 ~/.ssh/config 文件,添加 ProxyCommand 配置
| const parser = Sandbox.compile('a + b'); | |
| const result = parser({ a: 1, b: 2 }); | |
| // --- | |
| const parser = Sandbox.compile('a + b + alert', { throwOnUndefined: true }); | |
| const result = parser({ a: 1, b: 2 }); |
| # Linux:录制当前显示器 | |
| # - show_region: 显示录制区域 | |
| # - framerate: 录制的帧率 | |
| # - video_size: 录制区域的大小 | |
| # - $DISPLAY+0,0: `$DISPLAY`:环境变量,当前显示器 | |
| # `+0,0` 录制区域偏移量 | |
| # x11grab: http://underpop.online.fr/f/ffmpeg/help/x11grab.htm.gz | |
| ffmpeg -f x11grab -show_region 1 -framerate 8 -video_size 1024x768 -i $DISPLAY+0,0 -y output.mp4 | |
| # MacOS 录制屏幕 |