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:4705860
Created February 4, 2013 09:38
remove file by date
find . -mtime +5 -exec rm -rf {} \;
@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: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:5036347
Created February 26, 2013 06:25
Turnoff mysql unsafe statement warning
SET GLOBAL LOG_WARNINGS = 0
@bububa
bububa / gist:5046199
Created February 27, 2013 08:18
Debian管理启动项
通过ls /etc/init.d/以及ls /etc/rc?.d来查看当前的初始化服务。
update-rc.d -f mysqld remove命令将mysqld从启动项里删除
debian:/etc/init.d# cat ifup #ifup 命令
#!/bin/bash
ifup eth0
debian:/etc/init.d# chmod a+x ifup #添加可执行权限
debian:/etc/init.d# update-rc.d ifup defaults #添加启动项目
首先采用rcconf 管理
@bububa
bububa / tmux.conf
Last active December 14, 2015 06:59 — forked from mrosati84/tmux.conf
# status bar
set-option -g status-utf8 on
set-window-option -g mode-mouse on
#set-window-option -g mouse-resize-pane on
#set-window-option -g mouse-select-pane on
#set-window-option -g mouse-select-window on
set -g status-interval 1
set -g status-justify centre # center align window list
@bububa
bububa / gist:5329604
Created April 7, 2013 08:41
清除Mac OS X文件“打开方式”中的重复项
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"
@bububa
bububa / gist:5388838
Created April 15, 2013 15:14
problems in install gearmand
wget http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
yum -y -q install boost141-devel
ln -s /usr/include/boost141/boost/ /usr/include/boost
export LDFLAGS="-L/usr/lib64/boost141"
export LD_LIBRARY_PATH=/usr/lib64/boost141:$LD_LIBRARY_PATH
yum -y -q install e2fsprogs-devel e2fsprogs
yum -y -q install gcc44 gcc44-c++
export CC="gcc44"
export CXX="g++44"
sudo npm install -g phantomjs
sudo yum install bitmap-fonts bitmap-fonts-cjk liberation-fonts
cd /usr/share/fonts
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fv
sudo /usr/sbin/chkfontpath -a /usr/share/fonts/default/truetype/
sudo /etc/init.d/xfs reload
@bububa
bububa / gist:8536141
Created January 21, 2014 08:12
plproxy query setup
CREATE FUNCTION "plproxy"."get_cluster_config"(IN cluster_name text, OUT "key" text, OUT val text) RETURNS SETOF "record"
AS $BODY$
begin
key := 'statement_timeout';
val := 60;
return next;
return;
end; $BODY$
LANGUAGE plpgsql