rprice /.bashrc

my .bashrc from over the years
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

## Define colors
COLOR_RED="\[\e[31;40m\]"
COLOR_GREEN="\[\e[32;40m\]"
COLOR_YELLOW="\[\e[33;40m\]"
COLOR_BLUE="\[\e[34;40m\]"
COLOR_MAGENTA="\[\e[35;40m\]"
COLOR_CYAN="\[\e[36;40m\]"

COLOR_RED_BOLD="\[\e[31;1m\]"
COLOR_GREEN_BOLD="\[\e[32;1m\]"
COLOR_YELLOW_BOLD="\[\e[33;1m\]"
COLOR_BLUE_BOLD="\[\e[34;1m\]"
COLOR_MAGENTA_BOLD="\[\e[35;1m\]"
COLOR_CYAN_BOLD="\[\e[36;1m\]"

COLOR_NONE="\[\e[0m\]"

## Aliases
alias screensaver='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"'
alias top10='ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10'       # top10 processes being used
alias ftpseg='lftp ftp://seg.foo.bar.com/dropbox'
alias mkdir='mkdir -p -v'
alias ll='ls -lahF --color'
alias ls='ls -F --color'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias df='df -Th'               # Print filesystem type and human readable values
alias du='du -h -c'             # Human readable grand total
alias c='clear'
alias g='grep --color'
alias h='history'
alias t='tail -n 50'
alias x='exit'
alias recent='ls -lAt | head'   # Most recent files
alias grep='grep --color'       # Enable grep to color values when found

## Misc
PROMPT_COMMAND='history -a'     # Avoid history losses when using multiple terminals
export GREP_COLOR='1;32'        # Color value set to green
complete -cf sudo               # Tab complete for sudo

# default bash_history is 500
export HISTSIZE=1000
export HISTFILESIZE=1000
export HISTCONTROL=ignoredups
export HISTIGNORE="&:ls:ll:la:l.:pwd:exit:clear"
export LESS=-X                  # Don't clear screen after certain commands like 'man'

## set options
set -o noclobber                # prevent overwriting files with cat
set -o ignoreeof                # stops ctrl+d from logging me out

## shell options
shopt -s hostcomplete           # tab-completion of hostnames after @
shopt -s cdspell                # This will correct minor spelling errors in a cd command.
shopt -s histappend             # Append to history rather than overwrite (avoid histoy loss)
shopt -s checkwinsize           # Check window after each command
shopt -s dotglob                # files beginning with . to be returned in the results of path-name expansion.

## Personal Functions

# lazy man extract - example: ex tarball.tar
ex() {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)   tar xjfv $1        ;;
            *.tar.gz)    tar xzfv $1     ;;
            *.tar.xz)    tar xJfv $1     ;;
            *.bz2)       bunzip2 $1       ;;
            *.rar)       rar x $1     ;;
            *.gz)        gunzip $1     ;;
            *.tar)       tar xfv $1        ;;
            *.tbz2)      tar xjfv $1      ;;
            *.tgz)       tar xzfv $1       ;;
            *.zip)       unzip $1     ;;
            *.Z)         uncompress $1  ;;
            *.7z)        7z x $1    ;;
            *)           echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

# Remove an inode via inode number
rminode() {
        find . -inum $1 -exec rm -i {} \;
}

# Find the printer driver (ppd) type being used
printdriver() {
        lpoptions -d $1 | grep -oe "printer-make-and-model='.*'" | cut -f2 -d "=" | sed -r s/\'//g
}

# Corporate ldapsearch for users
ldapfind() {
        ldapsearch -x -h ldap.foo.bar.com -b dc=bar,dc=com uid=$1
}

# Get md5sums of all files in current directory.
md5sumdir() {
        find * -type f -exec md5sum {} \; &> md5sum.txt && echo "Success: md5sum.txt written" || echo "Error: md5sum.txt not written"
}

# Record desktop :: ffmpeg hosted via rpmfusion
record_desktop() {
        echo "Begin recording in:" ; sleep 1 ; echo 3 ; sleep 1 ; echo 2 ; sleep 1 ; echo 1 ; ffmpeg -f x11grab -s wxga -r 25 -i :0.0  -sameq /tmp/out.mpg && echo "Preview with 'mplayer /tmp/out.mpg'"
}


# Get file from dropbox/flopbox
# flopbox.foo.bar.com
# seg.foo.bar.com

flopbox() {
        lftp -e "get $1; quit" rprice@flopbox.foo.bar.com
}