This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Surge for Mac. Portnumber is 6152. | |
function surge_add() { | |
if [ "$1" == "--proxy" -o "$1" == "-p" -o "$1" == "--direct" -o "$1" == "-d" ]; then | |
if [ "$(cat ~/.surge.conf | grep -c $2)" -eq 0 ]; then | |
if [ "$1" == "--proxy" -o "$1" == "-p" ]; then | |
sed -i '' -e '539i \ | |
DOMAIN-SUFFIX,'$2',Proxy' ~/.surge.conf; | |
fi; | |
if [ "$1" == "--direct" -o "$1" == "-d" ]; then | |
sed -i '' -e '539i \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Surge for Mac | |
function surge_add() { | |
if [ "$1" == "--proxy" -o "$1" == "-p" -o "$1" == "--direct" -o "$1" == "-d" ]; then | |
if [ "$(cat ~/.surge.conf | grep -c $2)" -eq 0 ]; then | |
if [ "$1" == "--proxy" -o "$1" == "-p" ]; then | |
sed -i '' -e '541i \ | |
DOMAIN-SUFFIX,'$2',Proxy' ~/.surge.conf; | |
fi; | |
if [ "$1" == "--direct" -o "$1" == "-d" ]; then | |
sed -i '' -e '541i \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Surge for Mac 配置文件 | |
# 显示 Finder 隐藏文件,将 .surge.conf 文件复制到 ~/ 也就是「个人」目录下。 | |
[General] | |
# warning, notify, info, verbose | |
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local | |
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10 | |
loglevel = notify | |
# 默认 IP 和端口,不修改的话系统网络 HTTP 和 HTTPS 代理设置中就是 127.0.0.1:6152 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compress image with TinyJPG | |
function compress() { | |
if [ -n "${TinyJPG_API}" ]; then | |
for image in $*; do | |
local url=$(curl -i --user api:$TinyJPG_API --data-binary @"$image" https://api.tinify.com/shrink | grep Location: | awk '{split($0,a,": ");print a[2]}' | tr -d '\r'); | |
wget $url -O "$image"; | |
done | |
else | |
echo "TinyJPG_API is not defined! Please defined TinyJPG_API in ~/.path" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Easier navigation: .., ..., ...., ....., ~ and - | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias ~="cd ~" # `cd` is probably faster to type though | |
alias -- -="cd -" | |
# Shortcuts | |
alias db="cd ~/Dropbox" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias updatesketch='find $HOME/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application\ Support/com.bohemiancoding.sketch3/Plugins/ -name ".git" -exec git --git-dir={} pull ";"' |
NewerOlder