added some comments and updated fortune to auto select best one

moveTools
Adam Veldhousen 2015-06-26 09:30:42 -05:00
parent f8c49a017e
commit e4294be9d5
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B
1 changed files with 17 additions and 10 deletions

View File

@ -8,32 +8,40 @@ function prunelocal(){
for b in `git branch --merged | grep -v \*`; do git branch -D $b; done for b in `git branch --merged | grep -v \*`; do git branch -D $b; done
} }
# prints message of the day and a fortune
function printmotd(){ function printmotd(){
if [[ $WORK ]]; then if [[ $WORK ]]; then
cat ~/work_motd cat ~/work_motd
else else
cat ~/motd cat ~/motd
fi fi
echo ""
fortune if [[ -f $GOPATH/bin/fortune ]]; then
echo ""
$GOPATH/bin/fortune
elif [[ -f $(fortune) ]]; then
echo ""
fortune
fi
echo "" echo ""
} }
# prints battery percentage, only works on OSX
function batteryPercent(){ function batteryPercent(){
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%d", $10/$5 * 100)}' ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%d", $10/$5 * 100)}'
} }
# a shortcut for cloning from github
# usage: clone user/repo <dir>
function clone() function clone()
{ {
if [ -z "$1" ] if [ -z "$1" ]; then
then
echo "Missing git repository url ending" echo "Missing git repository url ending"
echo "usage: clone 'git repository ending' ['target directory name']" echo "usage: clone 'git repository ending' ['target directory name']"
else else
giturl="git@github.com:$1.git" giturl="git@github.com:$1.git"
if [ -z "$2" ] if [ -z "$2" ]; then
then
# we DON'T HAVE a target directory # we DON'T HAVE a target directory
git clone $giturl git clone $giturl
else else
@ -54,10 +62,9 @@ function b2dinit() {
echo "Initializing boot2docker" echo "Initializing boot2docker"
boot2docker init &> /dev/null boot2docker init &> /dev/null
boot2docker up &> /dev/null boot2docker up &> /dev/null
export DOCKER_HOST=tcp://$(boot2docker ip):2376
export DOCKER_CERT_PATH=~/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
fi fi
eval $(boot2docker shellinit)
} }
function vim(){ function vim(){