Skip to content

Instantly share code, notes, and snippets.

@khrome
Created March 17, 2015 17:56
Show Gist options
  • Save khrome/9b7be03c881ec0bce1ee to your computer and use it in GitHub Desktop.
Save khrome/9b7be03c881ec0bce1ee to your computer and use it in GitHub Desktop.
geektool macros
GITDIRTY_ISSUE="\033[01;31m"
GITDIRTY_HIGHLIGHT="\033[01;37m"
GITDIRTY_NORMAL='\033[00m'
gitdirty(){
local d="$1"
if [ -d "$d" ]; then
if [ -e "$d/.ignore" ]; then
echo -e ""
else
cd $d > /dev/null
if [ -d ".git" ]; then
DIRTYDIR="${d}"
ISDIRTY=$(git diff --shortstat 2> /dev/null | tail -n1)
[[ $ISDIRTY != "" ]] && printf "%-26s [${GITDIRTY_ISSUE}DIRTY${GITDIRTY_NORMAL}]\n" "$DIRTYDIR"
[[ $ISDIRTY == "" ]] && printf "%-26s [${GITDIRTY_HIGHLIGHT}CLEAN${GITDIRTY_NORMAL}]\n" "$DIRTYDIR"
else
gitdirtyrepos *
fi
cd .. > /dev/null
fi
fi
#echo "Exiting update: pwd=`pwd`"
}
gitdirtyrepos(){
#echo "`pwd`"
for x in $*; do
gitdirty "$x"
done
}
gitdirtyrepos <path>
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "$myen0" != "" ]
then
echo "LAN : $myen0"
else
echo "LAN : INACTIVE"
fi
myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "$myen1" != "" ]
then
echo "AIR : $myen1"
else
echo "AIR : INACTIVE"
fi
wip=`curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
echo "WAN : $wip”
ps -e -o pcpu,%mem,pid,ucomm,nice,state,cputime | sort -r
top -l2 -R -F -o CPU -stats PID,COMMAND,CPU,TH
uptime | awk '{sub(/[0-9]|user\,|users\,|load/, "", $6); sub(/mins,|min,/, "min", $6); sub(/user\,|users\,/, "", $5); sub(",", "min", $5); sub(":", "h ", $5); sub(/[0-9]/, "", $4); sub(/day,/, " day ", $4); sub(/days,/, " days ", $4); sub(/mins,|min,/, "min", $4); sub("hrs,", "h", $4); sub(":", "h ", $3); sub(",", "min", $3); print "UP : " $3$4$5$6}'
whoami
# using the scrawler font
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment