source /etc/profile 2>/dev/null source /etc/profile.d/* 2>/dev/null # Change prompt if root if [ $UID -eq 0 ] ; then PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]' else PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]' fi # Shorten long usernames if [ $(whoami | wc -c) -gt 10 ] ; then USER="me" else USER=$(whoami) fi export PATH=$PATH:~/bin:~/local/bin:~/local/usr/bin function tmux_title { printf '\033]2;%s\033\\' $@ } #tmux_title $(hostname -s) if [ -f ~/git/dotfiles/hosts/$(hostname -s)/bashrc ] ; then source ~/git/dotfiles/hosts/$(hostname -s)/bashrc else source ~/git/dotfiles/hosts/any/bashrc fi if type nvim &>/dev/null ; then alias vim=nvim fi # LS_COLORS eval $(dircolors -b $HOME/.dircolors) # Global Options export LS_OPTIONS="" export LESS='-R' export TERM=xterm-256color export MC_SKIN=$HOME/.mc/lib/solarized.ini # Better History HISTFILE=~/.bash_history HISTSIZE=100000 HISTTIMEFORMAT="%F %T " HISTCONTROL='ignorespace:ignoredups' HISTIGNORE='l:ls:history' # append to history, don't overwrite it shopt -s histappend # attempt to save all lines of a multiple-line command in the same history entry shopt -s cmdhist # save multi-line commands to the history with embedded newlines shopt -s lithist #if [ -e ~/.local/bin/virtualenvwrapper.sh ] ; then # # Python stuff # export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 # source ~/.local/bin/virtualenvwrapper.sh # export WORKON_HOME=/home/nold/.virtualenvs # export PIP_VIRTUALENV_BASE=/home/nold/.virtualenvs #fi # Functions function json2yaml { cat $@ | python3 -c 'import sys, yaml, json; print(yaml.dump(json.loads(sys.stdin.read())))' } # Aliases alias ls="ls --color=always --time-style=long-iso -F" alias dfh="df -hT -t ext4 -t zfs -t xfs" alias lsof='lsof 2>/dev/null | grep' alias winekiller="ps -ef | grep 'fusion|wine|\.exe' -E -i | awk '{ print \$2}' | xargs kill -9" # Git alias gs="git status" alias gc="git commit -m" alias gco="git checkout" alias gl="git l" alias ga="git add" alias gpush="git push" alias gpull="git pull" alias gcap="git commit --amend --no-edit && git push -f" # k3s / k8s / helm alias k="kubectl" alias kga="kubectl get all --all-namespaces -o wide" alias kgn="kubectl get nodes -o wide" alias kgp="kubectl get pods -o wide" # Completions for various tools... for bin in kubectl helm clusterctl talosctl flux ; do type $bin &>/dev/null && source <($bin completion bash) done