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:2761603
Created May 21, 2012 10:01
muinin setup
http://kevin.deldycke.com/2011/06/munin-monitor-debian-squeeze-server/
Again, here is a tutorial article exposing the recipe I use to cook a Munin on a Debian Squeeze.
As usual, let’s start by installing the main Munin package:
$ aptitude install munin
FYI, the version that aptitude choose to install was Munin 1.4.5. The default configuration coming along will make it produce graphs and HTML content to /var/cache/munin/www. Now we need to serve these pages via a web server.
As I wanted to play with nginx for a long time, I will use this opportunity to serve Munin’s content. The default version coming with Squeeze is quite old, so we’ll get the latest version from the Dotdeb repository:
@bububa
bububa / gist:2947281
Created June 18, 2012 07:25
Supervisord
REFERENCE: http://www.masnun.me/2011/11/02/gearman-php-and-supervisor-processing-background-jobs-with-sanity.html
apt-get install python-setuptools
easy_install supervisor
echo_supervisord_conf > /etc/supervisord.conf
=============================================
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
@bububa
bububa / gist:3103503
Created July 13, 2012 08:01
start tron
ssh-agent bash
/home/syd/.pythonbrew/pythons/Python-2.7.2/bin/python /home/syd/.pythonbrew/pythons/Python-2.7.2/bin/trond --pid-file=/var/run/trond.pid --working-dir=/home/syd/tron --host=192.168.99.51 --log-conf=/home/syd/tron/logging.conf
@bububa
bububa / gist:3607104
Created September 3, 2012 06:02
reset ulimit
# vi /etc/security/limits.conf
[Modify or add "nofile" (number of file) entries - note
that a userid can be used in place of *]
* soft nofile 64000
* hard nofile 64000
# vi /etc/pam.d/login
[Add the line]
session required /lib/security/pam_limits.so
@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 - 跳到下一个分隔窗口
@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: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:4474239
Created January 7, 2013 11:02
du sort
du | sort -nr | cut -f2- | xargs du -hs
@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: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;
}
......
}
}