flipje

bashrc

Jan 16th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.73 KB | None | 0 0
  1. #########################################################################################################
  2. ###                                                                                                   ###
  3. ###    SETTINGS                                                                                       ###
  4. ###                                                                                                   ###
  5. #########################################################################################################
  6.  
  7. # If not running interactively, don't do anything
  8. [ -z "$PS1" ] && return
  9.  
  10. # set editor
  11. export EDITOR=vim
  12. export VISUAL=vim
  13.  
  14. # meer settings
  15. export PAGER=less
  16. export BROWSER=firefox
  17. export LC_ALL=en_US.utf8
  18. export OS=$(uname)
  19.  
  20. # set default shell
  21. export SHELL="$( which bash)"
  22.  
  23. # set mailadres
  24. export MAIL="[email protected]"
  25.  
  26. # complete things that have been typed in the wrong case
  27. set completion-ignore-case on
  28.  
  29. # notify when jobs running in background terminate
  30. set -o notify                                  
  31.  
  32. # no empty completion (bash>=2.04 only)
  33. shopt -s no_empty_cmd_completion                
  34.  
  35. # (core file size) don't want any coredumps
  36. ulimit -S -c 0                                  
  37.  
  38. # don't want my shell to warn me of incoming mail
  39. unset MAILCHECK                                
  40.  
  41. # set tmpfile
  42. export TMP="${HOME}/tmp"
  43.  
  44. # set custom ps1
  45. export PS1='\[\033]0;\h:\w\007\]\[\033[01;32m\]\u@\h \[\033[01;34m\]\w \$ \[\033[00m\]'
  46.  
  47. #
  48. # PATH SETTINGS:
  49. #
  50. PATH='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
  51.  
  52. # mac toepassing
  53. if [ -d /usr/local/MacGPG2/bin ] ; then
  54.   PATH="${PATH}:/usr/local/MacGPG2/bin"
  55. fi
  56.  
  57. # x11 toolbox
  58. if [ -d  /usr/X11/bin ] ; then
  59.   PATH="${PATH}:/usr/X11/bin"
  60. fi
  61.  
  62. # scripts
  63. if [ -d "$HOME/scripts" ] ; then
  64.     PATH="$HOME/scripts:$PATH"
  65. fi
  66.  
  67. # home bin
  68. if [ -d "$HOME/bin" ] ; then
  69.   PATH="${PATH}:$HOME/bin"
  70. fi
  71.  
  72. # remove duplicate path entries
  73. export PATH=$(echo $PATH | awk -F: '
  74. { for (i = 1; i <= NF; i++) arr[$i]; }
  75. END { for (i in arr) printf "%s:" , i; printf "\n"; } ')
  76.  
  77. # autocomplete ssh commands
  78. complete -W "$(echo `cat ~/.bash_history | egrep '^ssh ' | sort | uniq | sed 's/^ssh //'`;)" ssh
  79.  
  80. # check the window size after each command and, if necessary,
  81. # update the values of LINES and COLUMNS.
  82. shopt -s checkwinsize
  83.  
  84. # history settings:
  85. shopt -s histappend
  86. PROMPT_COMMAND='history -a'
  87.  
  88. # don't put duplicate lines in the history.
  89. HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
  90. # ... or force ignoredups and ignorespace
  91. HISTCONTROL=ignoreboth
  92.  
  93. # Ctrl+D conveniently exits Bash Sometimes too conveniently
  94. export IGNOREEOF=1
  95.  
  96. # make less more friendly for non-text input files, see lesspipe(1)
  97. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  98.  
  99. # enable color support of ls and also add handy aliases
  100. if [ -x /usr/bin/dircolors ]; then
  101.     eval "`dircolors -b`"
  102.     alias ls='ls --color=auto'
  103.     alias dir='dir --color=auto'
  104.     alias vdir='vdir --color=auto'
  105.  
  106.     alias grep='grep --color=auto'
  107.     alias fgrep='fgrep --color=auto'
  108.     alias egrep='egrep --color=auto'
  109. fi
  110.  
  111. #########################################################################################################
  112. ###                                                                                                   ###
  113. ###    BASH COMPLETION                                                                                ###
  114. ###                                                                                                   ###
  115. #########################################################################################################
  116.  
  117. # enable programmable completion features (you don't need to enable
  118. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  119. # sources /etc/bash.bashrc).
  120. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  121.     . /etc/bash_completion
  122. fi
  123.  
  124. #########################################################################################################
  125. ###                                                                                                   ###
  126. ###    FUNCTIES                                                                                       ###
  127. ###                                                                                                   ###
  128. #########################################################################################################
  129.  
  130. # set custom functions
  131. if [ -f /media/filestore/user/.bash_functions ]; then
  132.     . /media/filestore/user/.bash_functions
  133. fi
  134.  
  135. #########################################################################################################
  136. ###                                                                                                   ###
  137. ###    ALIASSEN                                                                                       ###
  138. ###                                                                                                   ###
  139. #########################################################################################################
  140.  
  141. # set custom aliasses
  142. if [ -f /media/filestore/user/.bash_aliases ]; then
  143.     . /media/filestore/user/.bash_aliases
  144. fi
  145.  
  146. #########################################################################################################
  147. ###                                                                                                   ###
  148. ###    KEYCHAIN en GPG SETTINGS                                                                       ###
  149. ###                                                                                                   ###
  150. #########################################################################################################
  151.  
  152. # tel keymanager his key id
  153. export GPGKEY='YOURPGPKEYIDHERE'
  154.  
  155. # tel keymanager where his keys are:
  156. export GNUPGHOME='~/.gnupg'
  157.  
  158. # load ssh keys in from keymanager
  159. if [ -f ${HOME}/.keychain/$HOSTNAME-sh ] ; then
  160.   source ${HOME}/.keychain/$HOSTNAME-sh
  161. fi
  162.  
  163.  
  164. #########################################################################################################
  165. ###                                                                                                   ###
  166. ###    LEUK                                                                                           ###
  167. ###                                                                                                   ###
  168. #########################################################################################################
  169.  
  170. # echo birthday
  171. [ "$(date | cut -d ' ' -f 2,3)" == "Sep 11" ] && echo "happy birthday motherfucker!"
  172.  
  173. # Brute force way to block all LSO cookies on Linux system with non-free Flash browser plugin
  174. for A in ~/.adobe ~/.macromedia ; do ( [ -d $A ] && rm -rf $A ; ln -s -f /dev/null $A ) ; done
  175.  
  176. # greeting
  177. hour=$(date +"%H")
  178. if [ $hour -ge 0 -a $hour -lt 12 ]
  179. then
  180.   greet="Good Morning, $USER.\n"
  181. elif [ $hour -ge 12 -a $hour -lt 18 ]
  182. then
  183.   greet="Good Afternoon, $USER.\n"
  184. else
  185.   greet="Good Evening, $USER..\n"
  186. fi
  187. echo -e "${greet}"
  188.  
  189. # holiday greeting
  190. day=$(date +"%B%e")
  191. year=$(date +"%Y")
  192. hol=1
  193.  
  194. if [ "$day" = "January1" ]
  195. then
  196.   holgreet='Happy New Years. Have a Happy $year.\n'
  197. elif [ "$day" = "July4" ]
  198. then
  199.   holgreet='Have a Happy Forth of July.\n'
  200. elif [ "$day" = "October31" ]
  201. then
  202.   holgreet='Happy Halloween.\n'
  203. elif [ "$day" = "December24" ]
  204. then
  205.   holgreet='Merry Christmas Eve.\n'
  206. elif [ "$day" = "December25" ]
  207. then
  208.   holgreet='Merry Christmas.\n'
  209. elif [ "$day" = "December31" ]
  210. then
  211.   holgreet='Happy New Years Eve.\n'
  212. else
  213.   hol=0
  214. fi
  215.  
  216. # display holiday greeting
  217. if [ "$hol" = "1" ]
  218. then
  219. echo -e "${holgreet}"
  220. elif [ "$hol" = "0" ]
  221. then
  222.   randomvarthatsomehowimportant=0
  223. fi
Advertisement
Add Comment
Please, Sign In to add comment