# BASH configuration file
# By MB
# some examples / options 

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# HISTORY
#
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth:erasedups
export HISTIGNORE='&:ls:ll:cd ~:cd ..:[bf]g:exit:h:history'
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
export HISTSIZE=2000
export HISTFILESSIZE=2000
export PROMPT_COMMAND="history -a"        # update histfile after every command

# 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)"

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto -h --group-directories-first'
    alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias ...="cd ../.."    #go to grandparent dir
alias -- -="cd -"       #go to previous dir
alias l.='ls -d .*'     #list hidden files

# PATHs
export PATH=${PATH}:${HOME}/bin     # add ./bin directory
export PATH=${PATH}:${HOME}/.local/bin      # add .local/bin

# Python / Anaconda
# use your favorite python
# module show anaconda3 - use PATH
# or which python3
PYTHONROOT=
if [ -f "${PYTHONROOT}/etc/profile.d/conda.sh" ]; then
    # Sourcing this, is similar to conda init
    . "${PYTHONROOT}/etc/profile.d/conda.sh"
else
    export PATH="${PYTHONROOT}/bin:$PATH"
fi
# do not generate .pyc files
export PYTHONDONTWRITEBYTECODE=1

# Define your favorite editor
# /usr/bin/nano
export EDITOR=/usr/bin/vim
# Define your language
# run locale 
# export LANG=en_US.UTF-8

# User Limits
ulimit -u 10000  # max user processes 1024

# Limit number of Threads
# export MKL_NUM_THREADS=1
# export NUMEXPR_NUM_THREADS=1
export OMP_NUM_THREADS=4  # OpenMP Threads


# Special Modifications 
## environmental modules
export MODULES_PAGER=cat  # or less 
# Alias for JET to show running user services
alias running_services='systemctl list-units --user --type=service'
  