Skip to content

Instantly share code, notes, and snippets.

@sandywu
Created February 13, 2014 07:04
Show Gist options
  • Save sandywu/8971036 to your computer and use it in GitHub Desktop.
Save sandywu/8971036 to your computer and use it in GitHub Desktop.
. ~/bin/z/z.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# Set CLICOLOR if you want Ansi Colors in iTerm2
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Set colors to match iTerm2 Terminal Colors
# export TERM=xterm-256color
GREP_OPTIONS="--color=always";export GREP_OPTIONS
TRUNKPATH=/Users/sa/work/assets/trunk/juassets/assets/css
PATH=$PATH:~/bin/:/usr/local/sbin
alias proxy="ssh -qTfnN -D 7070 [email protected] -p 5800"
alias flushdns="dscacheutil -flushcache"
alias rssh="ssh -R 52698:127.0.0.1:52698 [email protected] -p 5800"
# Easier navigation: .., ..., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias preview="open -a '$PREVIEW'"
alias xcode="open -a '/Developer/Applications/Xcode.app'"
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'"
alias safari="open -a safari"
alias firefox="open -a firefox"
alias opera="open -a opera"
alias chrome="open -a google\ chrome"
alias chromium="open -a chromium"
alias f='open -a Finder'
alias photoshop="open -a '/Applications/Adobe Photoshop CC/Adobe Photoshop CC.app'"
alias tms="open -a google\ chrome 'http://tms.taobao.com'"
alias tps="open -a safari 'http://tps.tms.taobao.com/daogou/photo/index.htm'"
alias qrcode="open -a google\ chrome 'http://liantu.com'"
alias demo="open -a google\ chrome 'http://demo.alibaba-inc.com'"
alias alibaba="open -a google\ chrome 'http://www.alibaba-inc.com'"
alias work="open -a google\ chrome 'http://work.ju.taobao.net'"
alias h5="open -a safari 'http://h5.taobao.org/admin/pages.htm'"
alias ip="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
alias fs="stat -f \"%z bytes\""
alias phone="open \"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app\""
function findcss {
clear
cd $TRUNKPATH && svn update
grep $1 ./*
}
function push() {
currentBranch=`git rev-parse --abbrev-ref HEAD`
git add .
git commit -m "normalCommit"
git push origin $currentBranch
}
function ali() {
open -a google\ chrome "https://work.alibaba-inc.com/work/search?keywords=$1&type=all"
}
function gifit() {
ffmpeg -i $1 -pix_fmt rgb24 -r 8 -f gif - | gifsicle --optimize=3 --delay=10 > output.gif
}
function fix {
svn update && ant && svn commit -m "liuling bug fixed"
}
function server() {
sudo python -m "SimpleHTTPServer" $1
}
function sync() {
rsync -avz --progress --stats ./ admin@demo:/home/admin/demo/liuling/demo/wap
}
function parse_url_json() {
curl -s "$@" | python -m json.tool
}
function tabname {
printf "\e]1;$1\a"
}
function winname {
printf "\e]2;$1\a"
}
# Create a new directory and enter it
function md() {
mkdir -p "$@" && cd "$@"
}
# find shorthand
function f() {
find . -name "$1"
}
# Syntax-highlight JSON strings or files
function json() {
if [ -p /dev/stdin ]; then
# piping, e.g. `echo '{"foo":42}' | json`
python -mjson.tool | pygmentize -l javascript
else
# e.g. `json '{"foo":42}'`
python -mjson.tool <<< "$*" | pygmentize -l javascript
fi
}
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi
##
# Your previous /Users/sa/.bash_profile file was backed up as /Users/sa/.bash_profile.macports-saved_2013-06-25_at_12:02:10
##
# MacPorts Installer addition on 2013-06-25_at_12:02:10: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment