Last active
August 6, 2016 07:08
-
-
Save arrowrowe/af8a9a59ef9254bf65e9 to your computer and use it in GitHub Desktop.
ZSH configuration of @arrowrowe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)' "$@" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for use docker on mac osx, you need to follow this at15/mac-setup#2
eval "$(dockermachine env default)"