terdon

terdon's bashrc

Mar 29th, 2013
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.21 KB | None | 0 0
  1. # .bashrc
  2. pathmunge () {
  3.         if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
  4.            if [ "$2" = "after" ] ; then
  5.               PATH=$PATH:$1
  6.            else
  7.               PATH=$1:$PATH
  8.            fi
  9.         fi
  10. }
  11. setWindowTitle() {
  12.     echo -ne "\e]2;$*\a"
  13. }
  14. updateWindowTitle() {
  15.     setWindowTitle "$USER@${HOSTNAME%%.*}:${PWD/$HOME/~}"
  16. }
  17. #better autocomplete
  18. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  19.    . /etc/bash_completion
  20. fi
  21.  
  22. ## beep
  23. xset b off
  24.  
  25. #Make Bash append rather than overwrite the history on disk:
  26. shopt -s histappend
  27. #Whenever displaying the prompt, write the previous line to disk:
  28. #PROMPT_COMMAND='history -a'
  29.  
  30. #A new shell gets the history lines from all previous shells
  31. PROMPT_COMMAND='history -a; updateWindowTitle'
  32.  
  33. PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u@\h\[\033[01;34m\] \W \\$\[\033[00m\] '    
  34.  
  35. eval `dircolors -b $HOME/.mycolors`
  36.  
  37. export TERM=xterm;
  38. PERL5LIB=${PERL5LIB}:${HOME}/Setups/ensembl_API/src/bioperl-live
  39. PERL5LIB=${PERL5LIB}:${HOME}/Setups/ensembl_API/src/ensembl/modules
  40. PERL5LIB=${PERL5LIB}:${HOME}/Setups/ensembl_API/src/ensembl-compara/modules
  41. PERL5LIB=${PERL5LIB}:${HOME}/Setups/ensembl_API/src/ensembl-variation/modules
  42. PERL5LIB=${PERL5LIB}:${HOME}/Setups/ensembl_API/src/ensembl-functgenomics/modules
  43. export PERL5LIB="$HOME/Setups/PfamScan/:$HOME/.cpan/build/:$HOME/scripts:$PERL5LIB"
  44. export HISTCONTROL=ignoredups
  45. export HISTSIZE=9999
  46. export HISTFILESIZE=999999
  47. export HISTFILE="$HOME/.bash_history"
  48. export EDITOR='/usr/bin/emacs';
  49. pathmunge /home/terdon/bin
  50. pathmunge /home/terdon/scripts
  51. pathmunge /home/terdon/research/data/python
  52. pathmunge /home/terdon/Setups/PfamScan
  53. pathmunge /usr/sbin
  54. pathmunge /usr/local/sbin
  55. pathmunge /sbin
  56.  
  57. alias eog='eom'
  58. alias gping='ping www.google.com'
  59. alias nocolor='sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"'
  60. alias ls='ls --color=tty'
  61. alias kls='ls'
  62. alias sls='ls'
  63. alias dir='dir --color=yes'
  64. alias l='ls -lh'
  65. alias la='ls -a'
  66. alias cl='clear; ls'
  67. alias ..='cd ..'
  68. alias ...='cd ../../'
  69. alias mroe='more'
  70. alias m='more'
  71. alias ll='less -R'
  72. alias c='clear'
  73. alias rmr='rm -r'
  74. alias wtf='apropos'
  75. alias sl="ls"
  76. alias geneid2fasta='perl -ne "print unless /^#/ || /gene/ || /^\s+$/ || /\d/; print if /^>/;"'
  77. alias sru='sort -u'
  78. alias src='sort -u | wc -l'
  79. alias grprint='html2text $1'
  80. alias aterm='aterm -sl 10000'
  81. alias grep='grep --color'
  82. alias gerp='grep'
  83. alias clean_latex='rm .mtc .aux *.log *.bbl *.blg *.glo *.idx *.ilg *.ind *.maf *.out *.toc */.mtc* /.aux /.log /.bbl /.blg /.glo /.idx /.ilg /.ind /.maf /.out *.toc'
  84. function multi7z () {
  85.     for n in $@; do 7zr x $n; done
  86. }
  87.  
  88. function pdfconcat () { gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/dev/stdout "$@" ;}
  89. function bigdiff() {
  90.     for ((i=1; i<=$len; i++)); do
  91.     #echo "i:$i $len";
  92.     a=`gawk -v num=$i 'NR==num{print; exit}' $1`;
  93.     b=`gawk -v num=$i 'NR==num{print; exit}' $2`;
  94.     if [ "$a" != "$b" ];
  95.     then
  96.         echo -e "> $a\n< $b";  
  97.     fi;
  98.     done
  99.  
  100. }
  101. function netnames() {
  102.     if [ $1 ]; then
  103.     gawk '{print $1"\n"$2}' $1 | sort -u
  104.     else
  105.     echo -e "NETNAMES: Prints the unique names in a.gr file.\n\nUSAGE: netnames NET.gr"
  106.     fi
  107. }
Add Comment
Please, Sign In to add comment