2016-06-08 10:32:44 -04:00
|
|
|
function aws-profile {
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo Current AWS Profile: $AWS_DEFAULT_PROFILE
|
|
|
|
else
|
|
|
|
export AWS_DEFAULT_PROFILE=$1
|
2016-10-28 15:51:07 -04:00
|
|
|
export AWS_PROFILE=$1
|
2016-06-08 10:32:44 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-04-29 13:38:49 -04:00
|
|
|
function g {
|
|
|
|
if [[ $# > 0 ]]; then
|
|
|
|
git $@
|
|
|
|
else
|
|
|
|
git status
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-02-19 08:32:02 -05:00
|
|
|
function insert-sudo {
|
2013-05-28 23:32:51 -04:00
|
|
|
zle beginning-of-line
|
|
|
|
zle -U "sudo "
|
|
|
|
}
|
|
|
|
|
2013-05-28 22:25:28 -04:00
|
|
|
function port-forward {
|
2013-11-05 17:42:45 -05:00
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
echo Usage: port-forward HOST LOCAL_PORT \[REMOTE_PORT\]
|
|
|
|
else
|
|
|
|
ssh $1 -R ${3:-$2}":localhost:"$2 -g
|
|
|
|
fi
|
2013-05-28 22:25:28 -04:00
|
|
|
}
|
|
|
|
|
2014-08-21 05:56:28 -04:00
|
|
|
function gitignore-io {
|
2014-09-11 13:05:32 -04:00
|
|
|
curl https://www.gitignore.io/api/$@
|
2014-08-21 05:56:28 -04:00
|
|
|
}
|
2014-12-18 10:17:11 -05:00
|
|
|
|
|
|
|
function git-date-added {
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo Usage: git-date-added FILENAME
|
|
|
|
else
|
|
|
|
git log --format=%aD $1 | tail -1
|
|
|
|
fi
|
|
|
|
}
|
2016-02-05 13:52:00 -05:00
|
|
|
|
|
|
|
function run {
|
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
echo Usage: run NUMBER COMMAND
|
|
|
|
else
|
|
|
|
number=$1; shift
|
|
|
|
|
|
|
|
for i in `seq $number`; do
|
|
|
|
$@
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
2016-09-23 14:41:09 -04:00
|
|
|
|
|
|
|
function npm-exec {
|
|
|
|
(PATH=$(npm bin):$PATH; eval $@;)
|
|
|
|
}
|
2017-01-03 16:28:49 -05:00
|
|
|
|
|
|
|
# lazy loading
|
|
|
|
function rbenv {
|
|
|
|
eval "$(command rbenv init -)"
|
|
|
|
rbenv "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
function nodeenv {
|
|
|
|
eval "$(command nodenv init -)"
|
|
|
|
nodenv "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
function pyenv {
|
|
|
|
eval "$(command pyenv init -)"
|
|
|
|
eval "$(command pyenv virtualenv-init -)"
|
|
|
|
pyenv "$@"
|
|
|
|
}
|