Skip to content

Instantly share code, notes, and snippets.

@fay
fay / .bashrc
Created May 2, 2011 00:47
ubuntu .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@fay
fay / ubuntu.vim
Created May 3, 2011 05:07
ubutu vim default colortheme
" Vim color file
" Maintainer: Bohdan Vlasyuk <bohdan@vstu.edu.ua>
" Last Change: 2008 Jul 18
" darkblue -- for those who prefer dark background
" [note: looks bit uglier with come terminal palettes,
" but is fine on default linux console palette.]
set bg=dark
hi clear
@fay
fay / command
Created June 29, 2011 08:45
常用命令
1. 虚拟IP。我一般用来linux和虚拟机之间共享用的,因为考虑到linux宿主机的ip是动态ip会变化。我所见到的实际用途是负载均衡。
sudo ifconfig eth1:0 125.12.12.77
2. windows根据 ip查看主机名,公司内部主机名一般会是ALIBABA-XXXXX,XXXXX就是工号,这样就可以找到对应的人,当然如果是隔日的,需要考虑动态IP的问题。
nbtstat -a IP
3. awk
@fay
fay / svn-diff-meld
Created September 9, 2011 05:20
svn diff with meld on Ubuntu
#!/bin/sh
# SVN Diff Wrapper for Meld
# KOG 2008-02
# http://www.nabble.com/How-to-use-meld-with-'svn-diff'-td16765244.html
left="$6"
right="$7"
meld "$left" "$right"
@fay
fay / new_machine
Created September 9, 2011 05:24
new machine;run it with `sudo`
# development toolkits
apt-get install curl git mercurial vim
curl http://peak.telecommunity.com/dist/ez_setup.py | sudo python
easy_install pip
pip install virtualenv
pip install virtualenvwrapper
git clone http://github.com/revans/bash-it.git ~/.bash_it
~/.bash_it/install.sh
@fay
fay / .vimrc
Created September 9, 2011 07:42
vimrc settings
" set tab to 4 space
set smartindent
set expandtab
set tabstop=4
set shiftwidth=4
" display line number
set nu
" display tab and space as some other remarkable characters
@fay
fay / setup.sh
Created September 27, 2011 14:08
environ setup
APP_DIR=~/dev/jucan
VIRTUALENV_DIR = ~/.virtualenv
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
tar -xzvf setuptools-0.6c11.tar.gz
sudo python setuptools-0.6c11/setup.py install
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh
@fay
fay / crontab
Created October 9, 2011 02:25
common crontab usage
*/5 * * * * cmd #表示每五分钟运行一次
@fay
fay / git_branch
Created February 3, 2012 06:21
display current git branch
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
@fay
fay / rabbit mq
Created August 25, 2012 10:33
rabbit mq user permission
sudo rabbitmqctl add_vhost afaker
sudo rabbitmqctl set_permissions -p afaker fanjubian ".*" ".*" ".*"