Created
March 17, 2015 17:56
-
-
Save khrome/9b7be03c881ec0bce1ee to your computer and use it in GitHub Desktop.
geektool macros
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
| 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> |
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
| 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” |
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
| ps -e -o pcpu,%mem,pid,ucomm,nice,state,cputime | sort -r |
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
| top -l2 -R -F -o CPU -stats PID,COMMAND,CPU,TH |
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
| 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}' |
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
| whoami | |
| # using the scrawler font |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment