Created
April 30, 2016 21:46
-
-
Save mhoffman/4a5f34aaca066bb8469be26f36c7edb3 to your computer and use it in GitHub Desktop.
Revisions
-
mhoffman created this gist
Apr 30, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,834 @@ # ~/.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 running non interactively, do nothing ######################################################## #|# Preamble # ######################################################## [ -z "$PS1" ] && return # Determine platform first export platform='unknown' uname=$(uname) if [[ "x${uname}" == "xDarwin" ]]; then export platform='mac' elif [[ "x${uname}" == "xLinux" ]]; then export platform='linux' fi export dnsdomainname='unknown' if which dnsdomainname >/dev/null; then export dnsdomainname=$(dnsdomainname) else export dnsdomainname='unknown' fi export domainname='unknown' if which domainname >/dev/null; then export domainname=$(domainname) else export domainname='unknown' fi export hostname='unknown' if which domainname >/dev/null; then export hostname=$(hostname) else export hostname='unknown' fi ######################################################## #|# General # ######################################################## alias dirbashrc="grep -nT '^#|' ~/.bashrc" alias bashrc="vim ~/.bashrc" ######################################################## #|## Bash, PATH # ######################################################## # put here for early evaluation alias rebash='source ~/.bashrc' alias=ipython parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } ######################################################## #|## Extra git enhancements # ######################################################## # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc). if [ -f /etc/bash_completion ]; then . /etc/bash_completion elif [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then . /opt/local/etc/profile.d/bash_completion.sh elif [ -d ~/.bash_completion ]; then echo "Found user bash-completions" for fn in ~/.bash_completion/*sh; do echo ${fn} source ${fn} done fi # have to stay here before setting PS1 export GIT_PS1_SHOWDIRTYSTATE=true export export GIT_PS1_SHOWSTASHSTATE=true # set a fancy prompt declare -F | grep __git_ps1 > /dev/null if [ "$?" -eq 0 ] then echo ${platform} export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]:\w\[\033[31m\]$(__git_ps1 "(%s)")\[\033[01;34m\]$\[\033[00m\] ' else if [[ ${platform} == 'mac' ]]; then export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]:\w\[\033[31m\]$(parse_git_branch)\[\033[01;34m\]$\[\033[00m\] ' else export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]:\w\[\033[31m\]\[\033[01;34m\]$\[\033[00m\] ' fi fi PATH="${HOME}/.local/bin":\ "${HOME}/.scripts":\ "/var/lib/gems/1.9.1/bin":\ "/var/lib/gems/1.9/bin":\ "/var/lib/gems/1.8/bin":\ "${HOME}/.gem/ruby/1.9.1/bin":\ "${HOME}/.gem/ruby/2.0.0/bin":\ "${GOBIN}":\ ${PATH}; shopt -s cdspell shopt -s histappend shopt -s expand_aliases shopt -s lithist shopt -s extglob set show-all-if-ambiguous on # set bash to vi mode # (hit ESC for command mode/ # hit i for insert mode) #set -o vi # don't put duplicate lines in the history. See bash(1) for more options export HISTCONTROL=ignoredups export HISTIGNORE="&:ls:[bf]g:[cb]d:b:exit:[ ]*" export HISTSIZE=99999 # enable color support of ls and also add handy aliases export INPUTRC=~/.inputrc if [[ ${platform} == 'mac' ]]; then export CLICOLOR=YES eval `dircolors -b` export JAVA_HOME=$(/usr/libexec/java_home) else eval `dircolors -b` fi #key bindings bind '"\M-a"':"\"bd\"" bind '"\M-k"':"\"ls -f\"" # enable smart history search bind '"\e[A":history-search-backward' bind '"\e[B":history-search-forward' ######################################################## #|## Environment # ######################################################## export EDITOR=vim export FC="/usr/bin/gfortran" export F2PY_FCOMPILER='gfortran' export GDFONTPATH="/usr/share/fonts/truetype/latex-xft-fonts/" ######################################################## #|## Aliases, Utiliites # ######################################################## # bash sugar alias ls='ls --color=auto' alias cdreadlink='cd $(readlink -f .)' # cd to real absolute path alias ldir='ls -l --color=always | grep -e "^d"' # list only directories alias gr='grep' alias c='clear' alias ct='printf "\033c"' # clear terminal alias l='ls -lhtr --color=auto --time-style long-iso && pwd' alias ll='clear && ls -lhtr --color=auto --time-style long-iso && pwd' alias ltail='ls -rtlh | tail -n 20' alias j='jobs' alias g='gthumb' alias d='date' alias v='vim' alias rl='readlink -f' alias eb='vim ~/.bashrc' alias kk='kill %' alias dir='ls --color=auto --format=vertical' alias vdir='ls --color=auto --format=long' alias keyjnote='impressive -T 100 -t CrossFade ' alias git-svn-pull='git svn fetch; git merge git-svn' alias gitsy='git pull; git push' alias gy='gitsy' alias gitst='git st' alias modularize='touch __init__.py' alias top='htop -d 1' alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." alias ......="cd ../../../../.." alias .......="cd ../../../../../.." alias ........="cd ../../../../../../.." alias .........="cd ../../../../../../../.." alias ..........="cd ../../../../../../../../.." alias ...........="cd ../../../../../../../../../.." alias ............="cd ../../../../../../../../../../.." alias .............="cd ../../../../../../../../../../../.." alias vb=vboxmanage alias vh=vboxheadless alias sd="sudo shutdown -fh now" alias hk=heroku # Make the bash feel smoother # correct common typos alias sl='ls' alias iv='vi' alias vi='vim' alias dc='cd' alias tpo='top' alias otp='top' alias mem="ps aux | awk '{print \$2, \$4, \$11}' | sort -k2rn | head -n 20" alias t='top' alias db='bd' alias b='bd' alias rs='./manage.py runserver &' alias ds='./manage.py shell' alias dt='./manage.py test' alias pr='./tools/update_from_git.sh' alias ks='kmos shell' alias be='bundle exec' alias bert='bundle exec rake test' alias berd='bundle exec rake db:migrate' alias q='echo "You are not on a queueing system, dummy. Stop checking for running jobs!!!!"' alias nose=nosetests # vim alias vi=vim alias vim="vim -O" alias unlock="python -c 'from ctypes import *; X11 = cdll.LoadLibrary(\"libX11.so.6\"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2), c_uint(0)); X11.XCloseDisplay(display)'" alias getmyip="curl http://ipecho.net/plain" function fqpn(){ if [ "x${1}" == "x" ] then rel_path="." else rel_path="${1}" fi hn=$(hostname -f) pn=$(readlink -f ${rel_path} ) echo ${hn}:${pn} } function loclink(){ if [ "x${1}" == "x" ] then return else fn="${1}" fi cp --remove-destination $(readlink ${fn} ) ${fn} } function path(){ old=$IFS IFS=: printf "%s\n" $PATH IFS=$old } pantex (){ pandoc --csl=$(readlink -f ~/src/citation-styles/american-chemical-society.csl ) -sS --bibliography $(echo *.bib) ${1} -o $(basename ${1} .md).pdf } function n { seq 1 $1| { shift; xargs -i -- "$@"; } } function executify(){ file=${1} if [ -f ${file} -a ! -x ${file} ] then chmod 755 ${file} fi ./${file} } function pdfbiblatex(){ for command in pdflatex bibtex pdflatex pdflatex do ${command} ${1} done } function pdf_colorpages(){ gs -o - -sDEVICE=inkcov ${1} | grep -v "^ 0.00000 0.00000 0.00000" | grep -B1 CMYK | grep Page echo -en "Total pages" pdfinfo ${1} | grep Pages } function pdf_prepress(){ gs -sDEVICE=pdfwrite -dSAFER -dPDFSETTINGS=/prepress -dNOPAUSE -r150x150 -sOutputFile=$(basename ${1} .pdf)_prepress.pdf -dBATCH ${1} } function pdf_printer(){ gs -sDEVICE=pdfwrite -dSAFER -dPDFSETTINGS=/printer -dUseCIEColor=true -dNOPAUSE -r150x150 -sOutputFile=$(basename ${1} .pdf)_printer.pdf -dBATCH ${1} } function pdf_ebook(){ gs -sDEVICE=pdfwrite -dSAFER -dPDFSETTINGS=/ebook -dNOPAUSE -r150x150 -sOutputFile=$(basename ${1} .pdf)_ebook.pdf -dBATCH ${1} } function pdf_screen(){ gs -sDEVICE=pdfwrite -dSAFER -dPDFSETTINGS=/screen -dNOPAUSE -r150x150 -sOutputFile=$(basename ${1} .pdf)_screen.pdf -dBATCH ${1} } function pdf_bw(){ gs -sOutputFile=$(basename ${1} .pdf)_bw.pdf -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dNOPAUSE -dBATCH -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 $(basename ${1} .pdf).pdf < /dev/null } function pygraph(){ TMP=$(mktemp -d) sfood -i ${1} > ${TMP}/SFOOD sfood-graph ${TMP}/SFOOD > ${TMP}/SFOOD.dot dot -Tpdf ${TMP}/SFOOD.dot > SFOOD.pdf xpdf SFOOD.pdf rm -rf ${TMP} } function note(){ if [ "x${1}" == "x" ] then message='Hello World' else message=${1} fi notify-send -u normal -t 10 -i info 'hw' ${1} } function rsafevi() { link_name="${1}.$(date +"%Y%m%d-%H%M%S").$(sudo env | grep SUDO_USER | cut -d= -f 2)" sudo cp ${1} ${link_name} sudo vi ${1} #if [ ${link_name} -ef ${1} ] #then #sudo rm ${link_name} #fi } alias rvi=rsafevi function fname() { find . -name "*$@*"; } function fregex() { find . -regextype posix-egrep -regex "*$@*"; } function firegex() { find . -regextype posix-egrep -iregex "*$@*"; } function finame() { find . -iname "*$@*"; } function safevi() { cp ${1} ${1}.$(date +"%Y%m%d-%H%M%S") vi ${1} } # always use pushd/popd by default # and if directory turns out to be a file, we open it with vi :-) function cd() { if [ "$#" = "0" ] then pushd ${HOME} > /dev/null elif [ -f "${1}" ] then ${EDITOR} ${1} else pushd "$1" > /dev/null fi } # bd 5 goes 5 directories back in history function bd(){ if [ "$#" = "0" ] then popd > /dev/null else for i in $(seq ${1}) do popd > /dev/null done fi } function cdup(){ if [ "$#" = "0" ] then cd .. else reldir='' for i in $(seq ${1}) do reldir="${reldir}../" done cd ${reldir} fi } # bash bookmark manager, credit goes to getmizanur at Stackoverflow function bm() { bookmark_storage="${HOME}/.bookmarks" USAGE="Usage: cdb [-c|-g|-d|-l] [bookmark] cd -c <bookmark> Bookmark the current directory under <bookmark> cd -g <bookmark> Go to the directory saved under <boomark> cd -d <boomark> Delete directory under <bookmark> " ; if [ ! -e ${bookmark_storage} ] ; then mkdir ${bookmark_storage} fi case $1 in # create bookmark -c) shift if [ ! -f ${bookmark_storage}/$1 ] ; then echo "$(pwd)" > ${bookmark_storage}/"$1" ; else echo "Try again! Looks like there is already a bookmark '$1'" fi ;; # goto bookmark -g) shift if [ -f ${bookmark_storage}/${1} ] ; then cd $(cat ${bookmark_storage}/${1}) else echo "Mmm...looks like your bookmark has spontaneously combusted. What I mean to say is that your bookmark does not exist." ; fi ;; # delete bookmark -d) shift if [ -f ${bookmark_storage}/$1 ] ; then rm ${bookmark_storage}/"$1" ; else echo "Oops, forgot to specify the bookmark" ; fi ;; # list bookmarks -l) shift for bookmark in ${bookmark_storage}/* do echo "$(basename ${bookmark}) -> $(cat ${bookmark})" ; done ;; *) echo "$USAGE" ; ;; esac } # call pdflatex on a tex file and open with xpdf function xpdflatex(){ pdflatex ${1} xpdf $(basename ${1} .tex).pdf } # standard way to install python package in user space alias pyuserinstall='python setup.py install --user' alias line_profile="kernprof.py -lv" # shortcut for building standalone C program # from standalone Python script using Cython function cython-build(){ echo -e $1 cython --verbose --embed $1 gcc -O3 -I/usr/include/python2.7 -o $(basename ${1} .py) $(basename ${1} .py).c -lpython2.7 -lphtread -lm -lutil -ldl } # miscellaneous alias cleanmake='make clean; make' alias cm='cleanmake' if [[ ${platform} == 'linux' ]]; then alias units='units -e' fi alias xmod='xmodmap ~/.xmodmap' alias pysh='ipython --profile=pysh' # copy a file to middle mouse-button alias clip='xclip -selection clipboard' alias xclip='xclip -selection clipboard' pman() { # view man pages the fancy way tmp=$(mktemp); man -t $1 | ps2pdf - ${tmp} && xpdf -z 'width' -g 1280x1000 ${tmp} && rm ${tmp}; }; alias fuck='$(thefuck $(fc -ln -1))' alias pysyntax="python -m 'py_compile' " alias is=inkscape isexport(){ if [ "${2}x" = "x" ] then res=90 else res=${2} fi seed=$(basename ${1} .svg) JPEG2PS_INSTALLED=true hash jpeg2ps 2>/dev/null || JPE2PS_INSTALLED=false if $JPEG2PS_INSTALLED then inkscape --export-area-snap -e ${seed}.png ${1} -d ${res} -b white convert ${seed}.{png,jpg} jpeg2ps ${seed}.jpg > ${seed}.eps epstopdf ${seed}.eps # touch up to make it more current than pdf, for paper buildout touch ${seed}.eps else inkscape --export-area-snap -E $(basename ${1} .svg).eps -A $(basename ${1} .svg).pdf -e $(basename ${1} .svg).png ${1} -d ${res} fi } ######################################################## #|# Platform Specifics # ######################################################## ######################################################## #|## Mac OS X # ######################################################## if [[ ${platform} == 'mac' ]]; then export PATH=~/.cabal/bin:/opt/local/libexec/gnubin:${PATH}:/Users/$(whoami)/Library/Python/2.7/bin/:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin export DISPLAY="127.0.0.1:0.0" export CDPATH=.:~:~/src:~/stanford:~/phd:~/ssh_mounts export GOPATH=~/src/gocode export PATH=${PATH}:${GOPATH}/bin export PYTHONPATH="${HOME}/.local/lib/python2.7/site-packages/" export PATH=${PATH}:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin alias xpdf=open alias o=open alias finder=open alias nautilus=open ######################################################## #|## Linux # ######################################################## elif [[ ${platform} == 'linux' ]]; then export PATH=${PATH} export CDPATH=.:~:~/src fi ######################################################## #|# Host Specifics # ######################################################## ######################################################## #|## SLAC # ######################################################## if [ "x${dnsdomainname}" == "xslac.stanford.edu" ] then if [ "x${STY}" == "x" ] # check if we are in screen then # we are not ... echo ${DISPLAY} > /scratch/.$(whoami).display # first store the current value of $DISPLAY in a throaway file screen -ADR # then attach to existing screen session or start new one export IGNOREEOF=1 # to make sure we don't accidentalu kill the screen session export DISPLAY=$(cat /scratch/.$(whoami).display) # load the $DISPLAY variable again from filesystem rm -f /scratch/.$(whoami).display # delete throwaway file fi unset SSH_ASKPASS # otherwise the default askpass program just waits forever without an X server alias q='bjobs -w' alias qdel=bkill alias py='ipython --gui=None --pylab=None' alias qdelall="bjobs | tail -n+2 | awk '{print \$1}' | xargs bkill -r" function qrun(){ bjobs | head -n 1 bjobs | grep RUN echo "You have $(bjobs | grep RUN | wc -l) running jobs." } alias qstat='bjobs -u all | grep suncat' alias pri='bqueues -r suncat' alias p='bqueues -r suncat' alias g='display -resize 1024x768 -size 1024x768' function esp(){ python2.7 -m py_compile ${1} if [ $? -ne 0 ] then echo "Not compiling" return 1 fi chmod -v 755 $1 #esp-ver-bsub 17 -J "$(head -$((${RANDOM} % `wc -l < ~/.names` + 1)) ~/.names | tail -1)" $@ esp-ver-bsub 20 $@ } alias qsub=esp alias vmdt="vmd -dispdev text" #source /afs/slac/g/suncat/gpaw/setupenv export PATH=${PATH}:/afs/slac/g/suncat/bin:/usr/local/bin export CDPATH=.:~:~/src:/nfs/slac/g/suncatfs/maxjh export PYTHONPATH=/u/if/maxjh/.local/lib/python2.7/site-packages/:/nfs/slac/g/suncatfs/sw/espv17/lib/python2.7/site-packages/:${PYTHONPATH} #export PYTHONPATH=/nfs/slac/g/suncatfs/sw/espv17/lib/python2.7/site-packages/ export LD_LIBRARY_PATH=/nfs/slac/g/suncatfs/sw/espv17/intellib:/nfs/slac/g/suncatfs/sw/external/openmpi/1.6.3/install/lib:/afs/slac/package/lsf/curr/lib:/nfs/slac/g/suncatfs/sw/python276/lib64:/nfs/slac/g/suncatfs/sw/python276/lib:/nfs/slac/g/suncatfs/sw/python276noafs/intellib:/nfs/slac/g/suncatfs/sw/espv17/intellib:/nfs/slac/g/suncatfs/sw/external/openmpi/1.6.3/install/lib alias slac="echo 'You are already at SLAC!'" else alias slac="ssh -Y [email protected]" alias slacmount='sshfs -o workaround=rename -o follow_symlinks -o transform_symlinks [email protected]: ~/ssh_mounts/slac' function fromslac(){ scp -r "[email protected]:${1}" . } fi ######################################################## #|## sherlock # ######################################################## if [ "x$(hostname)" = "xsherlock-ln02.stanford.edu" -o "x$(hostname)" = "xsherlock-ln01.stanford.edu" ] then module load vmd/1.9.2 module load intel/2016.u1 module load QuantumEspresso/5.1.1/intel #module load python/2.7.5 module load openmpi/1.8.7/intel module load tensorflow/0.5.0 module load gcc/4.9.1 unset SSH_ASKPASS # otherwise the default askpass program just waits forever without an X server #source ~/.local/bin/activate alias q="qstat -u $(whoami)" alias qdelall="scancel -u $(whoami)" alias vpy=/home/vossj/suncat/bin/python #export PATH=/home/vossj/suncat/bin:${PATH} export CDPATH=.:~:~/src export PATH=/home/maxjh/env/kmos/bin/:/home/maxjh/.local/bin:${PATH} #export PYTHONPATH=${PYTHONPATH}:/home/vossj/suncat/lib/python2.7/site-packages export PYTHONPATH=/home/maxjh/env/kmos/lib/python2.7/site-packages:${PYTHONPATH} export PYTHONPATH=/home/maxjh/env/kmos/lib64/python2.7/site-packages:${PYTHONPATH} export PYTHONPATH=/home/maxjh/.local/lib/python2.7/site-packages:${PYTHONPATH} if [ "x${STY}" == "x" ] then echo ${DISPLAY} > /scratch/users/$(whoami)/display screen -ADR -s /bin/bash export IGNOREEOF=1 export DISPLAY=$(cat /scratch/users/$(whoami)/display) rm -f /scratch/users/$(whoami)/display fi else alias sherlock='kinit -R; ssh -KY sherlock.stanford.edu' function fromsherlock(){ scp -r "[email protected]:${1}" . } fi if [ "x$(hostname)" = "xpeekbox64" -a "x${dnsdomainname}" = "xtheo.chemie.tu-muenchen.de" ] then alias barriers='echo Stupid!' alias barriersmount='echo Stupid!' alias q='echo " No queueing system here, you knuckle-head !"' export PATH_TO_ARXIV='/mnt/arxiv_s3/' export DJANGO_SETTINGS_MODULE='settings' [ -z "$PYTHONPATH" ] && export PYTHONPATH="/user/hoffmann/src/cmr_install" [ -n "$PYTHONPATH" ] && export PYTHONPATH="/user/hoffmann/src/cmr_install:$PYTHONPATH" [ -z "$PATH" ] && export PATH="/user/hoffmann/src/cmr_install/tools" [ -n "$PATH" ] && export PATH="/user/hoffmann/src/cmr_install/tools:$PATH" else alias barriers='ssh [email protected]' alias barriersmount='sshfs [email protected]: ~/ssh_mounts/barriers' fi if [ "x${dnsdomainname}" = "xbc.rzg.mpg.de" ] then module load git module load intel module load impi/4.0.0 export CDPATH=.:~:~/src:~/calculations/2x2_thinslab/calc alias q="qstat | grep $(whoami)" export CASTEP_COMMAND='source /etc/profile.d/modules.sh; module load impi; mpiexec -n 64 /u/mhoffman/bin/castep' export CASTEP_PP_PATH='/u/mhoffman/CASTEP/PSPs' export PSPOT_DIR=${CASTEP_PP_PATH} alias py=ipython alias atop='tail $(ls -rt1 *.o* | tail -n 17)' else alias py='ipython --pylab=None --gui=None' alias ot=octave # aims cluster in garching alias heystunnel='ssh -N -f -l mhoffman -L 7778:heys.theo.chemie.tu-muenchen.de:22 server.theo.chemie.tu-muenchen.de' alias heys='ssh -l mhoffman -p 7778 localhost' alias aimstunnel='ssh -N -f -l mhoffman -L 7777:aims01.bc.rzg.mpg.de:22 gate.rzg.mpg.de' alias aims='ssh -l mhoffman -p 7777 localhost' alias aimsmount='sshfs -p 7777 mhoffman@localhost: ~/ssh_mounts/aimscluster -o workaround=rename' alias vip='ssh [email protected]' alias vipmount='sshfs [email protected]: ~/ssh_mounts/vip' alias vip='ssh [email protected]' alias vipmount='sshfs [email protected]: ~/ssh_mounts/vip' fi ######################################################## #|## CHEMIE TU MUENCHEN # ######################################################## if [ "x${dnsdomainname}" = "xtheo.chemie.tu-muenchen.de" -o "x$(hostname)" = "xheys" ] then if [ "x${hostname}" != "xserver" ] then source /user/hoffmann/.rvm/scripts/rvm # for using ruby fi export CDPATH=.:~:~/src:~/phd:~/ssh_mounts:/data/hoffmann #export http_proxy="http://proxy.theo.chemie.tu-muenchen.de:3128" export no_proxy=localhost,127.0.0.1 #export https_proxy="${http_proxy}" #export HTTP_PROXY="${http_proxy}" #export HTTPS_PROXY="${http_proxy}" export CASTEP_COMMAND='mpirun.openmpi -np 4 castep' export CASTEP_PP_PATH='/user/hoffmann/src/PSPs' alias ldapvi='/usr/bin/ldapvi --ldap-conf --bind sasl --tls strict --starttls --sasl-mech GSSAPI' k(){ if [ -n "$(tokens | grep afs)" ] then kinit -R else kinit --renewable --forwardable fi } else # server of theoretical chemistry in garching alias theochem='ssh [email protected] ' alias theochemmount='sshfs -o workaround=rename -o follow_symlinks -o transform_symlinks [email protected]: ~/ssh_mounts/theochem' fi ######################################################## #|## azetbur at FHI # ######################################################## if [ ! "x$(domainname)" = "xppb" ] # azetbur in berlin then alias azetbur='ssh [email protected]' alias azetmount='sshfs [email protected]: ~/ssh_mounts/azetbur' fi if [ "x$(hostname)" = "xbutz" ] then alias q='echo " No queueing system here, you knuckle-head !"' fi ######################################################## #|# Program Specifics # ######################################################## #set ifort environment variables if [ -e /opt/intel/bin/compilervars.sh ]; then source /opt/intel/bin/compilervars.sh ia32 fi if [ "x$(hostname)" = "xbutz" ] then export BLPAPI_ROOT=~/src/blpapi export GPGKEY=26067AA0 export GOPATH=~/src/go export PATH=$PATH:$GOPATH/bin alias battery='acpi -V | grep Battery' #alias xpdf=evince # Go variables export CDPATH=.:~:~/src:~/stanford:~/phd:~/ssh_mounts export GOBIN=~/src/go/bin export PATH=$PATH:$GOBIN export PATH_TO_ARXIV='/home/mhoffman/src/arxiv_s3' export CASTEP_COMMAND='castep' export CASTEP_PP_PATH='/home/mhoffman/src/CASTEP/PSPs' #source /home/mhoffman/.rvm/scripts/rvm # for using ruby bright(){ sudo -s "echo ${1} > /proc/acpi/video/OVGA/DD02/brightness" } # set environment variables for openFOAM #. /opt/openfoam201/etc/bashrc export PERL5LIB=~/.perl5/lib/perl5 # start redshift if not running fi export GPAW_SETUP_PATH=${HOME}/src/gpaw/gpaw-setups-0.8.7929 if ! which ag >/dev/null; then alias ag=ase-gui fi #if which hub &2>1 >/dev/null; then #alias git=hub #fi #PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting #if [[ ${platform} == 'linux' ]]; then ##which xmodmap && xmod #fi alias trm="echo 'your terminal is ' $TERM" ######################################################## #|## Package-Managment APT/Macports # ######################################################## # apt-get if [[ ${platform} == 'mac' ]]; then alias clean='sudo port clean' alias install='sudo port -v install' alias remove='sudo port uninstall' alias search='port -v search' alias show='port info' alias update='sudo port -v selfupdate' alias upgrade='sudo port upgrade outdated' alias vmd=' /Applications/VMD\ 1.9.2.app/Contents/MacOS/startup.command' else alias autoremove='sudo apt-get autoremove -y' alias build-dep='sudo apt-get build-dep' alias clean='sudo apt-get clean' alias dist-upgrade='sudo apt-get dist-upgrade' alias install='sudo apt-get install -y' alias purge='sudo apt-get remove --purge' alias reinstall='sudo apt-get install --reinstall' alias remove='sudo apt-get remove' alias search='apt-cache search' alias show='apt-cache show' alias update='sudo apt-get update' alias upgrade='sudo apt-get upgrade' fi ######################################################## #|## Heroku # ######################################################## if [ -d /usr/local/heroku/bin/ ] then export PATH="/usr/local/heroku/bin:$PATH" fi ######################################################## #|## NVM # ######################################################## if [ -d ${HOME}/.nvm ] then export NVM_DIR="${HOME}/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm fi This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ [user] name = hoffmannm email = [email protected] [color] ui = auto [color "branch"] current = yellow reverse local = yellow remote = green [color "diff"] meta = yellow bold frag = magenta bold old = red bold new = green bold [color "status"] added = yellow changed = green untracked = cyan [alias] st = status ci = commit br = branch co = checkout df = diff lg = log -p ps = push pl = pull sync = !"git pl; git ps" sy = !"git pl; git ps" gr = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit nicelog = log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" top = rev-parse --show-toplevel mt = mergetool man = help bad = bisect bad good = bisect good ar = !( git archive HEAD --prefix $(basename $(readlink -f .))-$($(basename $(readlink -f .)) version)/ --format tar | gzip > $(basename $(readlink -f .))-$($(basename $(readlink -f .)) version).tar.gz) root = rev-parse --show-toplevel vdiff = difftool -d -t opendiff contributors = !git log --format='%aN' | sort -u # use git like a feed reader ribbon = tag --force _ribbon origin/master catchup = log --reverse --topo-order _ribbon..origin/master d = difftool [sendemail] smtpserver = smtp.gmail.com smtpserverport = 587 smtpencryption = tls smtpuser = [email protected] [github] user = mhoffman [remote "aims"] uploadpack = /afs/rzg/.cs/git/@sys/1.8.4/bin/git-upload-pack receivepack = /afs/rzg/.cs/git/@sys/1.8.4/bin/git-receive-pack [push] default = matching [diff] tool = vimdiff [difftool] prompt = false [merge] tool = vimdiff This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,78 @@ #!/bin/bash -eu SCRIPTS_FOLDER=~/.scripts # Change this to wherever you keep custom scripts, this should be in you $PATH variable VIM_ROOT=~/.vim # The user vim directory for bundle managed plugins IPYTHON_ROOT=~/.ipython # full IPython customizations needs it own directory ... # Above the fold ###################################################################################################################### # below the fold # Determine platform first export platform='unknown' uname=$(uname) if [[ "x${uname}" == "xDarwin" ]]; then export platform='mac' elif [[ "x${uname}" == "xLinux" ]]; then export platform='linux' fi # install main config files for dotfile in bashrc #vimrc gitconfig xmodmap inputrc hgrc curlrc tmux.conf plan caffrc pypirc sblrc screenrc do if [ -L ~/.${dotfile} ] then rm ~/.${dotfile} fi ln -sv $(pwd)/${dotfile} ~/.${dotfile} done # install .vim/vim for vim vundle if [ -L ${VIM_ROOT}/vim ] then rm ${VIM_ROOT}/vim fi ln -sv $(pwd)/vim ${VIM_ROOT} mkdir -p ${IPYTHON_ROOT}/profile_default # install ipython config dir if [ -L ${IPYTHON_ROOT}/profile_default/ipython_config.py ] then rm ${IPYTHON_ROOT}/profile_default/ipython_config.py fi ln -sv $(pwd)/ipython_config.py ${IPYTHON_ROOT}/profile_default/ipython_config.py # install scripts folder if [ ! -d ${SCRIPTS_FOLDER} ] then mkdir -p ${SCRIPTS_FOLDER} fi # put scripts in scripts folder for script in scripts/* do if [ ! -e ${SCRIPTS_FOLDER}/$(basename ${script}) ] then if [[ ${platform} == 'mac' ]]; then ln -sv $(greadlink -f ${script}) ${SCRIPTS_FOLDER}/$(basename ${script}) else ln -sv $(readlink -f ${script}) ${SCRIPTS_FOLDER}/$(basename ${script}) fi fi done echo -e "\n\nIf vim shows attitude, run:" echo -e "git clone https://github.com/gmarik/Vundle.vim.git ${VIM_ROOT}/bundle/Vundle.vim" echo -e "vim +PluginInstall +qall" if [ ! -d ${VIM_ROOT}/bundle ] then echo "Ok, ok, I am already trying to do that" git clone https://github.com/gmarik/Vundle.vim.git ${VIM_ROOT}/bundle/Vundle.vim echo "And now let's try to install all those pesky plugins ..." vim +PluginInstall +qall echo "Done!" fi This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,299 @@ set nocompatible " be iMproved filetype off " required! set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'gmarik/Vundle.vim' Plugin 'closetag.vim' Plugin 'godlygeek/tabular' Plugin 'plasticboy/vim-markdown' Plugin 'scrooloose/nerdtree' Plugin 'comments.vim' Plugin 'browsereload-mac.vim' Plugin 'coffee.vim' Plugin 'vim-coffee-script' Plugin 'WebAPI.vim' Plugin 'Gist.vim' call vundle#end() " let Vundle manage Vundle " and don't put the comment on the same line """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " General behavior """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set autowrite " Speichert bei jedem :make, ;next, :rewind etc. set autoread if match($TERM, "screen")!=-1 set term=xterm endif set title " Set buffer name as terminal name " Schaltet syntax-highlighting und korrektes Einrücken an " und filetype spezifisches ein syntax on filetype plugin indent on " Vermeidet Probleme beim pasten aus dem Browser set paste " Stellt die Dateinamenerweiterung wie unter bash ein set wildmode=longest,list " Der Zeiger springt kurz zur öffnenden Klammer, wenn die schließende " eingegeben wird set showmatch set matchtime=1 " In diesem Fall 1/10 sek. set autoindent " automatic and smart indentation set smartindent set copyindent " Die Einrückweite pro Level set shiftwidth=4 " Ein Tab wird wie 2 Leerzeichen angezeigt und dank expandtab werden tabs " gleich als Leerzeichen eingefügt. set tabstop=4 set expandtab set softtabstop=4 set smarttab " Setzt die maximale Textbreite von Fließtext set linebreak set textwidth=66 " highlight lines that are to long " highlight OverLength ctermbg=red ctermfg=white guibg=#592929 " match OverLength /\%79v.\+/ " Wenn mit /suchwort gesucht wird, springt der Zeiger schon beim Eintippen set incsearch "Sucht standardmäßig ohne Groß- und Kleinschreibung zu unterscheiden set ignorecase "Blendet Zeileninformation ein set ruler "Blendet Formatierungszeichen ein set lcs=tab:>-,trail:-,nbsp:~ set nolist "Faltet automatisch neue Dateien nach Einrückung ein set foldmethod=indent "set foldcolumn=8 set foldlevel=8 set showcmd " Display an incomplete command in the lower right corner of the Vim window set mouse-=a " Disable mouse set mousehide " Hide mouse after chars typed """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Keyboard short cuts """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " change the mapleader from \ to , let mapleader="," "let mapleader=" " " Show trailing characters and such map <leader>st :set list<CR> " Quickly edit/reload the vimrc file nmap <silent> <leader>oc :e $MYVIMRC<CR> nmap <silent> <leader>rc :so $MYVIMRC<CR> " Shortcut for hypergit nmap <leader>g :ToggleGitMenu<CR> " Save files, close vim map <leader>w :w<CR> map <leader>x :x<CR> map <leader>q :q!<CR> " Shortcuts for NERD tree map <leader>n :NERDTree .<CR> " Simplify saving and closing of files "map <F5> :silent execute "!pdflatex % > /dev/null && xpdf -remote paper -reload > /dev/null &"<CR>ggG<C-o><C-o> map <F5> :!%<CR> map <F8> :w<CR> map <F10> :x<CR> " Spellcheck, ignore tex comments map <F9> :set spell<CR> let g:tex_comment_nospell=1 " Shortcuts for ConqueTerm shell map <leader>sh :ConqueTermSplit bash<CR> map <leader>vsh :ConqueTermVSplit bash<CR> map <leader>py :ConqueTermSplit ipython<CR> map <leader>vpy :ConqueTermVSplit ipython<CR> " open MRU menu nnoremap <leader>m :MRU<CR> " NERDtree on <leader>t nnoremap <leader>t :NERDTree<CR> " remove trailing whitespace map <leader>rt :%s/\s\+$//<CR> map <leader>sp :set paste<CR> map <leader>fl a.format(**locals())<ESC> map <leader>up i#!/usr/bin/env python<CR><CR>if __name__ == '__main__':<CR> map <leader>um i#!/usr/bin/env python<CR><CR>def main():<CR> pass<CR><CR>if __name__ == '__main__':<CR> main()<ESC> map <leader>in iif __name__ == '__main__':<CR> " open FuzzyFinder map <leader>ff :FufFile<CR> " Have NERDTree alway open in the current folder set autochdir let NERDTreeChDirMode=2 " Setzt die Ergebnisse einer Stringsuche immer in die Mitte des Bildschirms nmap n nzzzv nmap N Nzzzv nmap * *zzzv nmap # #zzzv nmap g* g*zzzv nmap g# g#zzzv " Change windows size next to each other using <, > "nmap <C-<> <C-w>< "nmap <C->> <C-w>> " Einrücken der ganzen Datei mit -- fun! BenIndent() let oldLine=line('.') normal(gg=G) execute ':' . oldLine endfun map -- :call BenIndent()<cr> let g:AutoPairsFlyMode=1 let g:AutoPairsShortCutBackInsert='<M-b>' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Language specific behavior """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Fortran " Fixes 'bug' in wrong form recognition let fortran_free_source=1 let fortran_fold=1 "autocmd FileType fortran compiler ifort " Java Spezifisches let java_highlight_all=1 let java_highlight_functions="style" let java_allow_cpp_keywords=1 " LaTeX Spezifisches set iskeyword+=: "let g:Tex_Env_theorem "\\pspicture(0,0)(,)(,)\<CR>\<CR>\\endpspicture" let g:Tex_DefaultTargetFormat='pdf' let g:Tex_CompileRule='latex --interaction=nonstopmode $*' let g:Tex_CompileRule_ps='dvips -q -Ppdf -o $*.ps $*.dvi' let g:Tex_CompileRule_pdf='ps2pdf $*.ps' let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf' let g:Tex_IgnoredWarnings=' \"Underfull\n". \"Overfull\n". \"specifier changed to\n". \"You have requested\n". \"Missing number, treated as zero.\n". \"There were undefined references\n". \"Citation %.%# undefined\n" \"Unused global option"' autocmd Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim ""Enables OmniComplete Toggeling with only Ctrl-n "set complete-=k complete+=k let NERDTreeIgnore=['\~$', '\.pyc$', '\.pyo$', '\.class$', 'pip-log\.txt$', '\.o$'] nnoremap <tab> <c-p> " Function to automagically increase number of marked column fun! Incr() let l = line(".") let c = virtcol("'<") let l1 = line("'<") let l2 = line("'>") if l1 > l2 let a = l - l2 else let a = l - l1 endif if a != 0 exe 'normal '.c.'|' exe 'normal '.a."\<c-a>" endif normal `< endfunction vnoremap <c-a> :call Incr()<CR> "jump to last position when reopen autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Plugin specific behavior """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " OmniCompletion "Omni Completion für alle möglichen sprachen einschalten autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS "autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS "autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags "autocmd FileType php set omnifunc=phpcomplete#CompletePHP "autocmd FileType c set omnifunc=ccomplete#Complete let g:SuperTabDefaultCompletionType = "context" set completeopt=menuone,longest,preview " for Goerz' sendToScreen gimmick autocmd BufNewFile,BufRead *.py let b:sendToProgramMode="ipython" let b:sendToProgramName="~/.vim/scripts/send2screen.py -S ipy1 " " settings for pydiction (Python tab completion) plugin) let g:pydiction_location="~/.vim/ftplugin/pydiction/complete-dict" let g:pydiction_menu_height=20 let g:tex_flavor='latex' "" for Go "filetype off "filetype plugin indent off "set runtimepath += "/usr/local/go/misc/vim" "filetype plugin indent on "syntax on let g:instant_markdown_slow = 1 " allow for better search and replace vnoremap <silent> s //e<C-r>=&selection=='exclusive'?'+1':''<CR><CR> \:<C-u>call histdel('search',-1)<Bar>let @/=histget('search',-1)<CR>gv omap s :normal vs<CR> function! NumberToggle() if(&relativenumber == 1) set number else set relativenumber endif endfunc nnoremap <C-n> :call NumberToggle()<cr>