Skip to content

Instantly share code, notes, and snippets.

@arrowrowe
Last active August 6, 2016 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arrowrowe/af8a9a59ef9254bf65e9 to your computer and use it in GitHub Desktop.
Save arrowrowe/af8a9a59ef9254bf65e9 to your computer and use it in GitHub Desktop.
ZSH configuration of @arrowrowe.
# Common
alias c='clear'
alias rp='cd $(realpath .)'
alias clip='xclip -sel clip'
alias o='xdg-open'
mkd() { mkdir -p $1; cd $1 }
mvi() { mv $1 $2; vi $2 }
cpi() { cp $1 $2; vi $2 }
confirm() {
local ans=''
read -q "ans?${1:=Sure?} [y/N] " -r -n 1
echo
case $ans in
[yY] )
true
;;
*)
false
;;
esac
}
# tmux
alias ta='tmux a || tmux'
alias tmuxx='tmux attach -t czhu'
# Markdown
mk() {
if [ "$#" -ne 1 ]; then
local f=""
else
local f="-- $(realpath $1)"
fi
(cd /code/third/Abricotine; npm start $f 2>>npm-start-error.log >> npm-start.log &)
}
# Docker
alias dk='docker'
alias dkp='dk ps'
alias dkpa='dkp -a'
alias dkrm='dk rm `dkpa -q`'
alias dkrmc='dk rm `dkpa | awk '"'"'/Exited/ { print $1 }'"'"'`'
alias dkrmn='dk rmi `dk images | awk '"'"'$1 == "<none>" { print $3 }'"'"'`'
# Git
alias gsync='gcm && gl official master && gp origin master'
# Go
alias addgp='export GOPATH=$GOPATH:$(pwd)'
# Java
j() { javac $1 && java -classpath . ${2-'Main'} }
# Node
alias n='node'
alias npi='npm i'
alias npr='npm run'
alias cnpm='npm --registry=https://registry.npm.taobao.org --cache=$HOME/.npm/.cache/cnpm --disturl=https://npm.taobao.org/dist --userconfig=$HOME/.cnpmrc'
# Multiple operations
foreval() {
local METHOD=$1
shift
while test ${#} -gt 0
do
local x=$1
if [ -d "$x/.git" ]; then
echo ==== $x =========================================
eval $METHOD
echo
fi
shift
done
echo ==== Done. =========================================
}
gli() { foreval '(cd $x; gl)' "$@" }
gsti() { foreval '(cd $x; gst)' "$@" }
@at15
Copy link

at15 commented Sep 8, 2015

for use docker on mac osx, you need to follow this at15/mac-setup#2
eval "$(dockermachine env default)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment