|
|
|
# ~/.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 not running interactively, don't do anything
|
|
|
|
case $- in
|
|
|
|
*i*) ;;
|
|
|
|
*) return ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
export EDITOR=vim
|
|
|
|
# export LC_ALL=en_US.UTF-8
|
|
|
|
# export LANG=en_US.UTF-8
|
|
|
|
|
|
|
|
##===== HISTORY =====##
|
|
|
|
|
|
|
|
# don't put duplicate lines or lines starting with space in the history.
|
|
|
|
# See bash(1) for more options
|
|
|
|
HISTCONTROL=ignoreboth
|
|
|
|
|
|
|
|
# append to the history file, don't overwrite it
|
|
|
|
shopt -s histappend
|
|
|
|
|
|
|
|
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) and add timestamp (HISTTIMEFORMAT)
|
|
|
|
HISTSIZE=10000
|
|
|
|
HISTFILESIZE=20000
|
|
|
|
HISTTIMEFORMAT="%d/%m/%y %T "
|
|
|
|
|
|
|
|
##===== Looks =====##
|
|
|
|
|
|
|
|
# check the window size after each command and, if necessary,
|
|
|
|
# update the values of LINES and COLUMNS.
|
|
|
|
shopt -s checkwinsize
|
|
|
|
|
|
|
|
# If set, the pattern "**" used in a pathname expansion context will
|
|
|
|
# match all files and zero or more directories and subdirectories.
|
|
|
|
#shopt -s globstar
|
|
|
|
|
|
|
|
# make less more friendly for non-text input files, see lesspipe(1)
|
|
|
|
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
|
|
|
|
|
|
# set variable identifying the chroot you work in (used in the prompt below)
|
|
|
|
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
|
|
|
debian_chroot=$(cat /etc/debian_chroot)
|
|
|
|
fi
|
|
|
|
|
|
|
|
color_prompt=yes
|
|
|
|
|
|
|
|
# Change this to the apropriate environment (dev|test|prod)
|
|
|
|
ENVIRONMENT=DEV
|
|
|
|
|
|
|
|
# I normaly have a green prompt on my local, yellow on Test and QA and red on Production systems
|
|
|
|
#if [ "$color_prompt" = yes ]; then
|
|
|
|
case "${ENVIRONMENT}" in
|
|
|
|
"DEV")
|
|
|
|
# Green prompt
|
|
|
|
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
|
|
|
;;
|
|
|
|
"TEST")
|
|
|
|
# Yellow prompt
|
|
|
|
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
|
|
|
;;
|
|
|
|
"PROD")
|
|
|
|
# Red prompt
|
|
|
|
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# colored GCC warnings and errors
|
|
|
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
|
|
|
|
|
|
|
# Add color to MAN pages,
|
|
|
|
## from https://www.tecmint.com/view-colored-man-pages-in-linux/
|
|
|
|
## by Aaron Kili, Published: December 12, 2017
|
|
|
|
export LESS_TERMCAP_mb=$'\e[1;32m'
|
|
|
|
export LESS_TERMCAP_md=$'\e[1;32m'
|
|
|
|
export LESS_TERMCAP_me=$'\e[0m'
|
|
|
|
export LESS_TERMCAP_se=$'\e[0m'
|
|
|
|
export LESS_TERMCAP_so=$'\e[01;33m'
|
|
|
|
export LESS_TERMCAP_ue=$'\e[0m'
|
|
|
|
export LESS_TERMCAP_us=$'\e[1;4;31m'
|
|
|
|
|
|
|
|
##===== Completion =====##
|
|
|
|
|
|
|
|
# enable programmable completion features (you don't need to enable
|
|
|
|
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
|
|
|
# sources /etc/bash.bashrc).
|
|
|
|
if ! shopt -oq posix; then
|
|
|
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
|
|
. /usr/share/bash-completion/bash_completion
|
|
|
|
elif [ -f /etc/bash_completion ]; then
|
|
|
|
. /etc/bash_completion
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f ${HOME}/.lib/q_completion.sh ]; then
|
|
|
|
source ${HOME}/.lib/q_completion.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
###===== HOMEBREW =====##
|
|
|
|
|
|
|
|
test -d /opt/homebrew && export PATH=/opt/homebrew/bin:~/bin:$PATH
|
|
|
|
|
|
|
|
###===== MQ and IIB =====##
|
|
|
|
#
|
|
|
|
## Add mq bin folder to PATH
|
|
|
|
test -d /opt/mqm/bin && export PATH=$PATH:/opt/mqm/bin
|
|
|
|
#
|
|
|
|
## Load MQSI profile
|
|
|
|
if [ -f /opt/IBM/iib-10.0.0.10/server/bin/mqsiprofile ]; then
|
|
|
|
[ -z "${PROSPECTIVE_MQSI_BASE_FILEPATH+MQSI_PROFILE_NOT_SET}" ] && source /opt/IBM/iib-10.0.0.10/server/bin/mqsiprofile
|
|
|
|
fi
|
|
|
|
|
|
|
|
##===== Alias definitions =====##
|
|
|
|
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
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 -alF'
|
|
|
|
alias la='ls -A'
|
|
|
|
alias l='ls -CF'
|
|
|
|
|
|
|
|
alias ws='cd ~/Documents/Code'
|
|
|
|
alias vcc='cd ~/Documents/Code/VOLVOCARS/'
|
|
|
|
alias fp='cd "$(findProject.sh)"'
|
|
|
|
|
|
|
|
alias doc='cd ~/Documents'
|
|
|
|
alias dw='cd ~/Downloads'
|
|
|
|
|
|
|
|
alias wn='cd ~/.config/nvim/'
|
|
|
|
alias cv='cd ~/.config/nvim/ ; vim init.norg lua/plugins.lua'
|
|
|
|
|
|
|
|
alias :q='exit'
|
|
|
|
alias vim='nvim'
|
|
|
|
alias nn='cd ~/notes/; nvim $(ls -tr $(ls -tr |grep -v "inbox.norg" | grep -e "[.]norg$" |tail -n1) $(ls -tr | grep -e "[.]md$" |tail -n1)); updateNotes.sh; cd -'
|
|
|
|
#
|
|
|
|
##===== Custom functions =====##
|
|
|
|
|
|
|
|
sleepUntil() { # args [-q] <HH[:MM[:SS]]> [more days]
|
|
|
|
if [ "$1" = "" ]; then
|
|
|
|
echo "args [-q] <HH[:MM[:SS]]> [more days]"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
local slp tzoff now quiet=false
|
|
|
|
[ "$1" = "-q" ] && shift && quiet=true
|
|
|
|
local -a hms=(${1//:/ })
|
|
|
|
printf -v now '%(%s)T' -1
|
|
|
|
printf -v tzoff '%(%z)T\n' $now
|
|
|
|
tzoff=$((0${tzoff:0:1}(3600*${tzoff:1:2}+60*${tzoff:3:2})))
|
|
|
|
slp=$((
|
|
|
|
( 86400+(now-now%86400) + 10#$hms*3600 + 10#${hms[1]}*60 +
|
|
|
|
${hms[2]}-tzoff-now ) %86400 + ${2:-0}*86400
|
|
|
|
))
|
|
|
|
$quiet || printf 'sleep %ss, -> %(%c)T\n' $slp $((now+slp))
|
|
|
|
sleep $slp
|
|
|
|
}
|
|
|
|
|
|
|
|
# Add JBang to environment
|
|
|
|
#alias j!=jbang
|
|
|
|
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
|
|
|
test -d /opt/homebrew/opt/openjdk/bin && export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
|
|
|
|
test -d /opt/homebrew/opt/curl/bin && export PATH="/opt/homebrew/opt/curl/bin:$PATH"
|
|
|
|
test -d ansible-setup/dotfiles/bin/ && export PATH="/Users/nige/.cargo/bin:$PATH"
|
|
|
|
|
|
|
|
# export GOPATH=$HOME/go
|
|
|
|
# which brew && export GOROOT="$(brew --prefix golang)/libexec"
|
|
|
|
# export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
|
|
|
|
export OPENAI_API_KEY='---------------------------------------------------'
|
|
|
|
export DENO_INSTALL="/home/nige/.deno"
|
|
|
|
export PATH="$DENO_INSTALL/bin:$PATH"
|