Created
October 12, 2014 20:43
-
-
Save vishbin/489e1601f76926fb5efb to your computer and use it in GitHub Desktop.
Revisions
-
vishbin created this gist
Oct 12, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,173 @@ # Set CLICOLOR if you want Ansi Colors in iTerm2 export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced #------------------------------------------//// # Prompt: #------------------------------------------//// #PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\](\[\033[01;34m\]\w\[\033[00;34m\])\[\033[01;32m\]:\[\033[00m\]' #PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\]\[\033[01;32m\]$\[\033[00m\]' #PS1='\033[01;32m\]$\[\033[00m\]' #export PS1="[\u@\h \W]\\$ " # Color definitions (taken from Color Bash Prompt HowTo). # Some colors might look different of some terminals. # For example, I see 'Bold Red' as 'orange' on my screen, # hence the 'Green' 'BRed' 'Red' sequence I often use in my prompt. # Normal Colors Black='\033[0;30m' # Black #Red='\033[0;31m' # Red Red='\033[0;31m' # Red RED='\033[0;31m' # Red #Red='\[\033[0;91m\]' # Red Green='\033[0;32m' # Green Yellow='\033[0;33m' # Yellow Blue='\033[0;34m' # Blue Purple='\033[0;35m' # Purple Cyan='\033[0;36m' # Cyan White='\033[0;37m' # White # Bold BBlack='\033[1;30m' # Black BRed='\033[1;31m' # Red BGreen='\033[1;32m' # Green BYellow='\033[1;33m' # Yellow BBlue='\033[1;34m' # Blue BPurple='\033[1;35m' # Purple BCyan='\033[1;36m' # Cyan BWhite='\033[1;37m' # White # Background On_Black='\033[40m' # Black On_Red='\033[41m' # Red On_Green='\033[42m' # Green On_Yellow='\033[43m' # Yellow On_Blue='\033[44m' # Blue On_Purple='\033[45m' # Purple On_Cyan='\033[46m' # Cyan On_White='\033[47m' # White NC="\033[m" # Color Reset # Set colors to match iTerm2 Terminal Colors export TERM=xterm-256color export HISTCONTROL=ignoredups:erasedups # no duplicate entries export HISTSIZE=100000 # big big history export HISTFILESIZE=100000 # big big history shopt -s histappend # append to history, don't overwrite it # Save and reload the history after each command finishes #export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" # lock computer alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend' alias which='type -all' # which: Find executables # lr: Full Recursive Directory Listing # ------------------------------------------ alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less' # showa: to remind yourself of an alias (given some part of it) # ------------------------------------------------------------ showa () { /usr/bin/grep --color=always -i -a1 $@ ~/Library/init/bash/aliases.bash | grep -v '^\s*$' | less -FSRXc ; } # ttop: Recommended 'top' invocation to minimize resources # ------------------------------------------------------------ # Taken from this macosxhints article # http://www.macosxhints.com/article.php?story=20060816123853639 # ------------------------------------------------------------ alias ttop="top -R -F -s 10 -o rsize" # my_ps: List processes owned by my user: # ------------------------------------------------------------ my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,start,time,bsdtime,command ; } #-------------------------------------------------------------------------------------------------------------------------------------------- google() { local s="$_" local query= case "$1" in '') ;; that) query="search?q=${s//[[:space:]]/+}" ;; *) s="$*"; query="search?q=${s//[[:space:]]/+}" ;; esac open /Applications/Google\ Chrome.app/ "http://www.google.com/${query}" } export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}: ${PWD/#$HOME/~}\007"' #PS1="\[\033[1;30m\][\[\033[1;34m\]\u\[\033[1;30m\]@\[\033[0;35m\]\h\[\033[1;30m\]] \[\033[0;37m\]\W \[\033[1;30m\]\$\[\033[0m\] " #-------------------------------------------------------------------------------------------------------------------------------------------- function my_ip() # get IP adresses { MY_IP=$(/sbin/ifconfig eth0 | awk "/inet/ { print $2 } " | sed -e s/addr://) MY_ISP=$(/sbin/ifconfig eth0 | awk "/P-t-P/ { print $3 } " | sed -e s/P-t-P://) } function ii() # get current host related info { echo -e "\nYou are logged on ${RED}$HOST" echo -e "\nAdditionnal information:$NC " ; uname -a echo -e "\n${RED}Users logged on:$NC " ; w -h echo -e "\n${RED}Current date :$NC " ; date echo -e "\n${RED}Machine stats :$NC " ; uptime #echo -e "\n${RED}Memory stats :$NC " ; free my_ip 2>&. ; echo -e "\n${RED}Local IP Address :$NC" ; echo ${MY_IP:."Not connected"} echo -e "\n${RED}ISP Address :$NC" ; echo ${MY_ISP:."Not connected"} echo } #-------------------------------------------------------------------------------------------------------------------------------------------- # Get weather (replace the 71822 in the url with your own zipcode, call it by typing weather) weather(){ curl -s "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=${@:-94150}"|perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';} weather1(){ curl -s "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';} #-------------------------------------------------------------------------------------------------------------------------------------------- upinfo () { echo -ne "${green}$HOSTNAME ${red}uptime is ${cyan} \t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}' } #------------------------------------------//// # System Information: #------------------------------------------//// clear echo -e "${LIGHTGRAY}";figlet -w 100 "Tech Singularity is imminent"; echo -ne "${Red}Today is:\t\t${cyan}" `date`; echo "" echo -e "${Red}Kernel Information: \t${Cyan}" `uname -smr` echo -ne "${Cyan}";upinfo;echo "" #echo -e "${Cyan}"; cal echo Weather curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=0\&locCode\=94105\ | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p' echo -e "${Green}"; weather1 san francisco echo -e "${White} "; echo "" /usr/bin/php /Users/lhg254/workspaces/scripts/quote.php echo ""