-
-
Save bingeboy/5924494 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"` | |
# get the load averages | |
read one five fifteen rest < /proc/loadavg | |
echo "$(tput setaf 2) | |
.~~. .~~. `date +"%A, %e %B %Y, %X %Z"` | |
'. \ ' ' / .' `uname -srmo`$(tput setaf 1) | |
.~ .~~~..~. | |
: .~.'~'.~. : Uptime.............: ${UPTIME} | |
~ ( ) ( ) ~ Memory.............: `cat /proc/meminfo | grep MemFree | awk {'print $2'}`kB (Free) / `cat /proc/meminfo | grep MemTotal | awk {'print $2'}`kB (Total) | |
( : '~'.~.'~' : ) Load Averages......: ${one}, ${five}, ${fifteen} (1, 5, 15 min) | |
~ .~ ( ) ~. ~ Running Processes..: `ps ax | wc -l | tr -d " "` | |
( : '~' : ) CPU Temperature....: `/opt/vc/bin/vcgencmd measure_temp | cut -c 6-9 | awk '{ print $1 "°C" }'` | |
'~ .~~~. ~' Free Disk Space....: `df -Ph | grep -E '^/dev/root' | awk '{ print $4 " of " $2 }'` | |
'~' IP Addresses.......: `/sbin/ifconfig eth0 | /bin/grep "inet addr" | /usr/bin/cut -d ":" -f 2 | /usr/bin/cut -d " " -f 1` and `wget -q -O - http://icanhazip.com/ | tail` | |
Weather............: Brooklyn`curl -s "http://rss.accuweather.com/rss/liveweather_rss.asp?metric=211&LOCCODE=11211" | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p'` | |
$(tput sgr0)" | |
############################################################################################################################### | |
alias refresh='source ~/.bash_profile' | |
############################################################################################################################### | |
# Easier navigation: .., ..., ~ and - | |
alias ..="cd .." | |
alias cd..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias ~="cd ~" # `cd` is probably faster to type though | |
alias -- -="cd -" | |
alias hosts='sudo vim /etc/hosts' # yes I occasionally 127.0.0.1 twitter.com ;) | |
# handy things | |
alias bunyip='node ~/code/bunyip/cli.js' | |
alias spotify="osascript ~/code/SpotifyControl/SpotifyControl.scpt" | |
alias vlc="osascript ~/code/VLCControl/VLCControl.scpt" | |
# Detect which `ls` flavor is in use | |
if ls --color > /dev/null 2>&1; then # GNU `ls` | |
colorflag="--color" | |
else # OS X `ls` | |
colorflag="-G" | |
fi | |
# List all files colorized in long format | |
alias l="ls -l ${colorflag}" | |
# List all files colorized in long format, including dot files | |
alias la="ls -la ${colorflag}" | |
# List only directories | |
alias lsd='ls -l | grep "^d"' | |
# Always use color output for `ls` | |
if [[ "$OSTYPE" =~ ^darwin ]]; then | |
alias ls="command ls -G" | |
else | |
alias ls="command ls --color" | |
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' | |
fi | |
# `cat` with beautiful colors. requires Pygments installed. | |
# sudo easy_install Pygments | |
alias c='pygmentize -O style=monokai -f console256 -g' | |
# GIT STUFF | |
# Undo a `git push` | |
alias undopush="git push -f origin HEAD^:master" | |
# git root | |
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`' | |
# IP addresses | |
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" | |
alias localip="ipconfig getifaddr en1" | |
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" | |
# Enhanced WHOIS lookups | |
alias whois="whois -h whois-servers.net" | |
# Flush Directory Service cache | |
alias flush="dscacheutil -flushcache" | |
# View HTTP traffic | |
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" | |
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" | |
# Canonical hex dump; some systems have this symlinked | |
type -t hd > /dev/null || alias hd="hexdump -C" | |
# OS X has no `md5sum`, so use `md5` as a fallback | |
type -t md5sum > /dev/null || alias md5sum="md5" | |
# Trim new lines and copy to clipboard | |
alias trimcopy="tr -d '\n' | pbcopy" | |
# Recursively delete `.DS_Store` files | |
alias cleanup="find . -name '*.DS_Store' -type f -ls -delete" | |
# Shortcuts | |
alias g="git" | |
alias v="vim" | |
# File size | |
alias fs="stat -f \"%z bytes\"" | |
# One of @janmoesen’s ProTip™s | |
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do | |
alias "$method"="lwp-request -m '$method'" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swapped weather to BK