Skip to content

Instantly share code, notes, and snippets.

View bububa's full-sized avatar
💭
I may be slow to respond.

Prof Syd Xu bububa

💭
I may be slow to respond.
View GitHub Profile
@bububa
bububa / gist:5036347
Created February 26, 2013 06:25
Turnoff mysql unsafe statement warning
SET GLOBAL LOG_WARNINGS = 0
@bububa
bububa / gist:4749020
Created February 10, 2013 09:58
fix percona conflict
To achieve this you create a file, i.e.:
/etc/apt/preferences.d/percona
and put this inside:
Package: *
Pin: release l=percona
Pin-Priority: 700
@bububa
bububa / gist:4745678
Created February 9, 2013 15:19
pwdgen algorithm
base62(base64(sha512(hexstr(md5(encrypt_key+encrypt_salt))+site_id+site_salt)))[0:len]
// base64 -> base62
// 'i' -> "ii"
// '+' -> "ip"
// '/' -> "is"
// '=' -> "ie"
其中encrypt_key是用户输入的加密口令, base62是为了去掉特殊字符.
@bububa
bububa / gist:4705860
Created February 4, 2013 09:38
remove file by date
find . -mtime +5 -exec rm -rf {} \;
@bububa
bububa / gist:4682063
Created January 31, 2013 10:47
Nginx限制ip连接数和流量控制
http {
limit_conn_zone $binary_remote_addr zone=perip:10m;
server {
......
location {
limit_conn perip 10;
}
......
}
}
@bububa
bububa / gist:4482232
Created January 8, 2013 08:41
skynet setup demo
export DOOZER_BOOT_URI="doozer:?ca=192.168.99.51:8046&ca=192.168.99.52:8046&ca=192.168.99.53:8046"
// ON 192.168.99.51
nohup /var/code/go/bin/doozerd -timeout 5 -l "192.168.99.51:8046" -w false -c "dzns" > /dev/null 2>&1 &
// ON 192.168.99.52
nohup /var/code/go/bin/doozerd -timeout 5 -l "192.168.99.52:8046" -w false -c "dzns" -a "192.168.99.51:8046" > /dev/null 2>&1 &
printf '' | /var/code/go/bin/doozer -a "doozer:?ca=192.168.99.51:8046" add "/ctl/cal/1"
// ON 192.168.99.53
nohup /var/code/go/bin/doozerd -timeout 5 -l "192.168.99.53:8046" -w false -c "dzns" -a "192.168.99.51:8046" > /dev/null 2>&1 &
printf '' | /var/code/go/bin/doozer -a "doozer:?ca=192.168.99.51:8046" add "/ctl/cal/2"
@bububa
bububa / gist:4474239
Created January 7, 2013 11:02
du sort
du | sort -nr | cut -f2- | xargs du -hs
@bububa
bububa / gist:4460663
Last active December 10, 2015 16:28
xibao mongo and db config
sh.addShard("rs0/srv-7:27019")
sh.addShard("rs1/srv-5:27019")
sh.addShard("rs2/srv-6:27019")
sh.enableSharding("oplog")
sh.enableSharding("sem_crawler")
sh.enableSharding("aggregate")
sh.enableSharding("keyword_insights")
sh.enableSharding('crawler')
sh.enableSharding('words')
sh.shardCollection("oplog.oplogs", {campaign_id:1})
@bububa
bububa / gist:4449893
Created January 4, 2013 04:22
use sshfs to mount path from another server
sshfs [email protected]:/var/www /var/www -o idmap=user -o allow_other -o uid=33 -o gid=33
@bububa
bububa / gist:4391037
Created December 27, 2012 19:08
tmux
Ctrl+b " - split pane horizontally
Ctrl+b % - 将当前窗格垂直划分
Ctrl+b 方向键 - 在各窗格间切换
Ctrl+b,并且不要松开Ctrl,方向键 - 调整窗格大小
Ctrl+b c - (c)reate 生成一个新的窗口
Ctrl+b n - (n)ext 移动到下一个窗口
Ctrl+b p - (p)revious 移动到前一个窗口.
Ctrl+b 空格键 - 采用下一个内置布局
Ctrl+b q - 显示分隔窗口的编号
Ctrl+b o - 跳到下一个分隔窗口