#!/bin/bash setterm -initialize -blank 0 -cursor on if [[ $- != *i* ]]; then return fi if [ -f /etc/bashrc ]; then . /etc/bashrc fi case "$-/${ENV_SET:-no}" in *i*/no) set -o ignoreeof function exit { . ~/.bash_logout builtin exit } ;; esac eval `dircolors -b /etc/DIR_COLORS` [ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion # # Environment Variables & Settings ################################################################################ umask 022 ulimit -S -c 0 set -o notify set -o noclobber set +o nounset #set -o xtrace # debugging shopt -s cdspell shopt -s cdable_vars shopt -s checkhash shopt -s checkwinsize shopt -s cmdhist shopt -s dotglob extglob shopt -s histappend histreedit histverify shopt -s hostcomplete shopt -s no_empty_cmd_completion shopt -s sourcepath shopt -u mailwarn unset MAILCHECK PROMPT_COMMAND='history -a' export HOST=$(hostname) export OS=`uname` export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n' export HISTSIZE=3000 export HISTFILESIZE=5000 export HISTIGNORE="&:bg:fg:h" export HISTCONTROL=ignoredups export TMOUT=6400 export PATH=~/Library/_bin:~/Library/_bin/eclipse:$PATH export JAVA_HOME=/usr/lib/jvm/sun-jdk-1.6 #export LD_LIBRARY_PATH=/opt/gimp-devel/lib #export PKG_CONFIG_PATH=/opt/gimp-devel/lib/pkgconfig export CCACHE_DIR=/var/tmp/ccache export XDG_MENU_PREFIX=gnome- #export WINDOW_MANAGER=/usr/bin/sawfish export EDITOR=/usr/bin/vim export MYVIMRC=~/.vim/vimrc export BROWSER=/usr/bin/firefox export WWW_HOME=http://68.147.60.50/devel/ export GDK_USE_XFT=1 export MOZ_DISABLE_PANGO=1 export LESS=-R # # Prompt ################################################################################ PS1="\n `date "+%H:%M%n"` \[\033[1;32m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::') \ \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \ \[\033[1;33m\](\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b)\[\033[0m\] \ \[\033[1;36m\]\w \n" case `id -u` in 0) PS1="${PS1}\[\033[1;31m\]\u@\h \[\033[1;31m\]::\[\033[0m\] ";; *) PS1="${PS1}\[\033[0;36m\]\u@\h \[\033[0;36m\]=>\[\033[0m\] ";; esac ## File & Directory Controls ############################################## alias ls="ls -Abh --color=always" alias lsl="ls -l" alias df="df -kTh" alias cdca="cd ~/Library/Code/Web-based/Applications" alias cdw="cd ~/Projects/www/htdocs" alias srca="cd ~/Projects/Sources/Applications" alias srct="cd ~/Projects/Sources/Theming" ## Administration ############################################## alias s="su - root" alias S="su" ## Editing ############################################## alias n="nano -w" alias v="vim" alias b="v ~/.bashrc" alias gr="v /boot/grub/grub.conf" alias grm="mount /boot && v /boot/grub/grub.conf && umount /boot" alias mk="v /etc/make.conf" alias pu="v /etc/portage/package.use" alias cpu="cat /etc/portage/package.use | grep $1" alias xo="v /etc/X11/xorg.conf" alias lynx="lynx -accept_all_cookies" ## System Installation & Upgrade ############################################## alias svng="svn co http://svn.gnome.org/svn/$1 $2" alias upf="fc-cache -f -v" alias emerge="emerge -v" alias e="emerge -v" alias eup="e --sync && e world -up" alias eudp="e --sync && e world --newuse -uDp" alias eu="e world -u" alias eud="e world --newuse -uD" ## Environment ############################################## alias c="clear" case `id -u` in 0) alias en="env-update && source /etc/profile";; *) alias en="source /etc/profile";; esac alias et="etc-update" alias dp="dispatch-conf" alias edf="rm -rf /usr/portage/distfiles/*" alias his="history | grep $1" ## Applications ############################################## alias x="startx" alias ap="/etc/init.d/apache2 restart" alias sq="/etc/init.d/mysql restart" alias al="/etc/init.d/alsasound restart" alias mysql="mysql -u jason -p" alias mysqlr="mysql -u root -p" alias kgp="killall -9 gnome-panel" alias burndisc="cdrecord -v -pad -speed=16 dev=/dev/sr0 $1" alias ga="gnome-appearance-properties" alias fl="flac2mp3 `pwd` `pwd`" alias www="lynx http://$1" alias wpinstall="svn co http://svn.automattic.com/wordpress/trunk/ ." ## Directories ############################################## alias mg='cd ~/Media/Music && find ./ -type d -exec sh -c "mp3gain \"{}\"/*.mp3" \;' alias mgfull='cd ~/Media/Music && find ./ -type d -exec sh -c "mp3gain -cTpfr \"{}\"/*.mp3" \;' ## Networking ############################################## alias rsw="rs ~/Projects/www/" alias pi="ping -c 3 www.gentoo.org" alias jdm="ssh jdmlabs@espresso.dreamhost.com" # # Functions ################################################################################ ### REBOOT function rb() { shutdown -r now } ### SHUTDOWN function sd() { shutdown -h now } ### ADDUSE function adduse() { echo $1 >> /etc/portage/package.use sort /etc/portage/package.use -o /etc/portage/package.use } ### ADDMASK function addmask() { echo $1 >> /etc/portage/package.mask sort /etc/portage/package.mask -o /etc/portage/package.mask } ### UNMASK function unmask() { echo $1 >> /etc/portage/package.unmask sort /etc/portage/package.unmask -o /etc/portage/package.unmask } ### ADDKW function addkw() { echo $1 >> /etc/portage/package.keywords sort /etc/portage/package.keywords -o /etc/portage/package.keywords } ### COMPILE & INSTALL KERNEL function mkk() { local usage="mkk < kernel_version >" if [ "$#" -lt 1 ]; then echo "$usage" return; fi cd /usr/src/linux mount /boot env-update source /etc/profile make make modules_install cp .config ../config-gentoo cd /boot cp /usr/src/linux/System.map ./System.map cp /usr/src/linux/arch/x86_64/boot/bzImage ./$1 echo "\n\n\n\nHooray! :)\n\n\n" echo "I have successfully compiled the kernel and copied '$1' to the /boot dir\n\n" cd /usr/src/linux lsl /boot umount /boot } ### RSYNC LAPTOP function rs() { dir=$1 rsync -arvuz $dir icarus:$dir } ### GOOGLE SEARCH function gg() { SEARCH=$(echo $* | sed -e 's/ /\%20/g') www www.google.com/search?q="$SEARCH" } ### RENAME FILES function rename() { criteria=$1 re_match=$2 replace=$3 for i in $( ls *$criteria* ); do src=$i tgt=$(echo $i | sed -e "s/$re_match/$replace/") mv $src $tgt done } ### RENAME EXTENSION function renameext() { for f in *.$1; do mv $f $f%$1}$2 done } ### MUSIC CLEAN function mc() { cd ~/Media/Music find ./ -type f -name ".directory" -print0 | xargs -0 rm -f find ./ -type d -empty -print0 | xargs -0 rmdir cd } ### WINDOWS CLEANER function windowscleaner() { cd ~/Media/Music find ./ -type f -name "desktop.ini" -print0 | xargs -0 rm -f find ./ -type d -empty -print0 | xargs -0 rmdir cd }