macOS 命令行升级

1softwareupdate --install -a

October 8, 2020

使用docker搭建transmission Client

Transmission A fast, easy, and free BitTorrent client 官网:https://transmissionbt.com/ Docker 镜像:https://hub.docker.com/r/lin...

August 14, 2020

Gio

Immediate mode GUI programs in Go for Android, iOS, macOS, Linux, FreeBSD, OpenBSD, Windows, and WebAssembly (experimental). gioui.org

July 5, 2020

Docker Compose Container 之间相互通信

Docker Compose Container 之前相互通信 因 links 属性已被废弃,官方建议使用 networks 来将几个 container 划分至一个网络,从而实现 container 之间互通。 创建一个桥接网络 docker network create YOUR_NET_NAME 默认网络方式即为桥接...

December 6, 2019

Nginx Hardening Checklist

May 22, 2019

macOS 10.14 设置4位以下密码

macOS 10.14 后,系统不能设置 4 位以下密码。 解决方法: 打开终端或 Iterm2: 1pwpolicy -clearaccountpolicies 然后修改密码,或直接命令行修改 1passwd

May 12, 2019

GO emoji 正则表达式

1// emoji regexp 2// \{1F300}-\x{1F64F}\x{1F680}-\x{1F6FF}\x{2600}-\x{2B55} 3emoji := `😂` 4if matched := regexp. 5 MustCompile(`^[a-zA-Z0-9_\p{Han}\{1F300}-\x{1F64F}\x{1F680}-\x{1F6FF}\x{2600}-\x{2B55}]{1,20}$`). 6 Match([]byte(emoji)); true { 7 log.Println(matched) 8}

March 28, 2019

SubString for go (works well with unicode)

1// SubString works well with unicode 2func SubString(str string, start int, length int) string { 3 r := []rune(str) 4 n := len(r) 5 if start >= n || length <= 0 { 6 return "" 7 } 8 9 if start < 0 { 10 start = 0 11 } 12 end := start + length 13 if end > n { 14 end = n 15 } 16 17 return string(r[start:end]) 18}

January 25, 2019

Git 清空所有commit记录方法

Checkout git checkout --orphan latest_branch Add all the files git add -A Commit the changes git commit -am "commit message" Delete the branch git branch -D master Rename the current branch to master git branch -m master Finally, force update your repository git push -f origin master

January 4, 2019

openresty 直接解析markdown文件

原理 通过 openresty 的 body_filter 对 markdown 文件进行“包装”,添加html的外衣; marked.js 前端解析 markdown 为html格式。 使用方法 克隆或下载源码; 将enable-markdown...

January 4, 2019