Skip to content

Instantly share code, notes, and snippets.

@hogelog
Created February 15, 2012 08:23
Show Gist options
  • Save hogelog/1834409 to your computer and use it in GitHub Desktop.
Save hogelog/1834409 to your computer and use it in GitHub Desktop.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
if [ $TTY ] ; then
stty stop 'undef'
fi
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
window=`echo $WINDOW`
if [ -z $window ]; then
wps=""
else
wps="[$window]"
fi
PS1='$wps\[\033[01;34m\]\w\[\033[00m\] \$ '
PS1="\[\e]0;\h $wps \w\a\]$PS1"
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
alias cp='cp -f'
alias mv='mv -f'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ls='ls -F --color=auto'
alias ll='ls -lF --color=auto'
alias la='ls -aF --color=auto'
alias rr='screen -U -RR'
alias ..='cd ..'
alias gcc='colorgcc'
function gomi (){
for file in $*
do
__rm_single_file $file
done
}
function __rm_single_file(){
if ! [ -d ~/trash/ ]
then
command /bin/mkdir ~/trash
fi
if ! [ $# -eq 1 ]
then
echo "__rm_single_file: 1 argument required but $# passed."
exit
fi
if [ -e $1 ]
then
BASENAME=`basename $1`
NAME=$BASENAME
COUNT=0
while [ -e ~/trash/$NAME ]
do
COUNT=$(($COUNT+1))
NAME="$BASENAME.$COUNT"
done
command /bin/mv $1 ~/trash/$NAME
else
echo "No such file or directory: $file"
fi
}
alias gomi-look='ls -a ~/trash/ 2> /dev/null'
alias gomi-clean='\rm -rf ~/trash/*;\rm -rf ~/trash/.??*'
. /etc/bash_completion
. $HOME/.cdd/cdd
export ANDROID_SDK=/opt/android-sdk-linux_x86/
export PATH=\
$HOME/local/bin:\
$ANDROID_SDK/tools:\
$ANDROID_SDK/platform-tools:\
/opt/bin:\
$PATH
#export JAVA_HOME=/usr/lib/jvm/java-6-sun
#export JRE_HOME=$JAVA_HOME/jre
export JAVA_HOME=/opt/jre1.6.0_30
export JRE_HOME=$JAVA_HOME
export ANT_HOME=/opt/ant
export M2_HOME=/opt/maven
export CATALINA_HOME=/opt/tomcat
export EDITOR=vim
export PAGER='lv -c'
export LD_LIBRARY_PATH=/opt/opencv/lib:\
$LD_LIBRARY_PATH
export PYTHON_LIBRARY_PATH=/opt/opencv/lib
# vim: set ft=sh sw=4 ts=4 et:
#!/bin/sh
cdddir=$HOME/.cdd
cddfile=$cdddir/cddfile
cddtmp=$cdddir/cddtmp
cddmax=20
function cdd_init() {
if [ ! -d $cdddir ]; then
mkdir $cdddir
fi
if [ ! -f $cddfile ]; then
for i in `seq $cddmax`
do
echo >> $cddfile
done
fi
touch $cddfile
touch $cddtmp
}
function cdd_cd() {
dir=`head -\`perl -e"print \"$1\"+1"\` $cddfile |tail -1`
builtin cd $dir
}
function cdd_ls() {
perl -nle 'print "\t", $n++, " $_"' $cddfile
}
function cdd_rec() {
perl -nle "\$c=\$i++;if(\$c==$1){print'$2'}else{print}" $cddfile > $cddtmp
cp $cddtmp $cddfile
}
function cdd() {
cdd_init
if [ $1 ]; then
cdd_cd $1
if [ $WINDOW ]; then
cdd_rec $WINDOW `pwd`
fi
else
cdd_ls
fi
}
function cd() {
cdd_init
builtin cd $@
if [ $WINDOW ]; then
cdd_rec $WINDOW `pwd`
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment