Skip to content

Instantly share code, notes, and snippets.

@johrstrom
Created May 12, 2021 15:59
Show Gist options
  • Save johrstrom/96b03df4a538fe543b663c47313905c6 to your computer and use it in GitHub Desktop.
Save johrstrom/96b03df4a538fe543b663c47313905c6 to your computer and use it in GitHub Desktop.
My ~/.bashrc that I use on OSC systems
# .bashrc
function source_if_exists() {
if [ -f $1 ]; then
. $1
fi
}
# cat file descriptors (1 and 2, stdout and stderr)
function cfd() {
cat /proc/$1/fd/1 /proc/$1/fd/2
}
# tail -f file descriptors (1 and 2, stdout and stderr)
function tfd() {
tail -f /proc/$1/fd/1 /proc/$1/fd/2
}
function emoji(){
emojis=(<U+1F436> <U+1F43A> <U+1F431> <U+1F42D> <U+1F439> <U+1F430> <U+1F438> <U+1F42F> <U+1F428> <U+1F43B> <U+1F437> <U+1F42E> <U+1F435> <U+1F43C> <U+1F427> <U+1F40D> <U+1F422> <U+1F419> <U+1F420> <U+1F433>
<U+1F42C> <U+1F425>)
echo ${emojis[$RANDOM % 22]}
}
function git_branch(){
git rev-parse --abbrev-ref HEAD 2> /dev/null
}
function load_modules(){
modules=( 'git' 'project/ondemand' 'project/classes' "ruby/$RUBY_VERSION")
#modules+=('python/3.7-2019.10')
#modules=('python/3.6-conda5.2')
#modules+=('python/3.7-2019.10')
modules+=('gnu/9.1.0' 'mkl/2019.0.5') # R/4.0.2
module purge 2>/dev/null
module restore 2>/dev/null
for mod in ${modules[@]}
do
module load $mod 2>/dev/null
done
}
function pit() {
if [ -n "$1" ]; then
DEST="pitzer-login0$1.hpc.osc.edu"
else
DEST=pitzer.osc.edu
fi
ssh johrstrom@$DEST
}
# Source global definitions
source_if_exists /etc/bashrc
source_if_exists /opt/rh/rh-ruby27/enable
source_if_exists /opt/rh/rh-nodejs12/enable
source_if_exists /opt/rh/rh-git29/enable
#source_if_exists $HOME/.local/etc/lmods
#source_if_exists $HOME/.Renviron
export RUBY_VERSION="2.7.1"
#export RUBY_VERSION="2.5.5"
load_modules
alias jobs='qstat -ujohrstrom'
alias logs='tail -f /var/log/ondemand-nginx/johrstrom/*.log'
alias maya='singularity exec $MAYA_IMG'
alias cbc="cd /users/PZS0714/johrstrom/ondemand/data/sys/dashboard/batch_connect/sys"
alias pip="python -m pip"
alias herstory="history"
alias gs='git status'
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH="$PATH:$HOME/.gem/ruby/bin"
#export LANG='en_US.UTF-8'
export JULIA_DOWNLOAD="$HOME/.julia/packages/IJulia"
#export R_LIBS_USER="$HOME/R/test/%V"
#export LD_LIBRARY_PATH="/usr/lib:/usr/lib64:/lib:/lib64:$LD_LIBRARY_PATH"
#export SINGULARITYENV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
#export SINGULARITY_BINDPATH=/etc,/media,/mnt,/run,/srv,/usr,/var,/users,/opt
export GEM_HOME="$HOME/.gem/ruby"
#export GIT_COMMITTER_NAME="Jeff Ohrstrom"
#export GIT_COMMITTER_EMAIL="johrstrom@osc.edu"
export NUM_USR='15'
#export PS1="\[\033[0;36m\][\u@\h \T \W(\$(git_branch))] \$(emoji) \[\e[0m\] "
#export PS1="[\W \$(emoji)]$ "
export PS1="\[\033[0;36m\][\u \W(\$(git_branch))] \$(emoji) \[\e[0m\] "
#export XDG_CONF_DIRS="/tmp"
export OOD_TEMPLATE_DIR="$HOME/ondemand/misc/osc-ood-config"
export PRJ="/fs/project/PZS0714/johrstrom"
# activate the conda environment
#source activate bc-desktop
# testing R
R_SRC="$HOME/src/R"
R_SITE="$R_SRC/site"
R_4="$R_SRC/R-4.0.3"
export PATH="$R_4/bin:$R_SITE/bin:$PATH"
export LD_LIBRARY_PATH="$R_4/lib:$R_SITE/lib:$HOME/:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="$R_SITE/include:$PKG_CONFIG_PATH"
unset LD_PRELOAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment