2017-11-11 11:36:23 +00:00
|
|
|
source /etc/profile 2>/dev/null
|
|
|
|
source /etc/profile.d/* 2>/dev/null
|
|
|
|
|
2024-01-04 15:28:24 +00:00
|
|
|
if [ -e /usr/bin/gnome-keyring-daemon ] ; then
|
|
|
|
source <(/usr/bin/gnome-keyring-daemon --start --components=ssh)
|
|
|
|
fi
|
|
|
|
|
2017-11-03 08:46:24 +00:00
|
|
|
# Change prompt if root
|
2017-11-03 07:49:05 +00:00
|
|
|
if [ $UID -eq 0 ] ; then
|
|
|
|
PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]'
|
|
|
|
else
|
|
|
|
PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]'
|
|
|
|
fi
|
|
|
|
|
2017-11-03 08:46:24 +00:00
|
|
|
# Shorten long usernames
|
|
|
|
if [ $(whoami | wc -c) -gt 10 ] ; then
|
|
|
|
USER="me"
|
|
|
|
else
|
|
|
|
USER=$(whoami)
|
|
|
|
fi
|
|
|
|
|
2022-02-15 07:34:33 +00:00
|
|
|
export PATH=$PATH:~/bin:~/local/bin:~/local/usr/bin
|
2017-11-03 07:09:33 +00:00
|
|
|
|
|
|
|
function tmux_title {
|
|
|
|
printf '\033]2;%s\033\\' $@
|
|
|
|
}
|
2019-08-02 05:41:01 +00:00
|
|
|
#tmux_title $(hostname -s)
|
2017-11-03 07:09:33 +00:00
|
|
|
|
2022-12-22 10:18:25 +00:00
|
|
|
if [ -f ~/git/dotfiles/hosts/$(hostname -s)/bashrc ] ; then
|
|
|
|
source ~/git/dotfiles/hosts/$(hostname -s)/bashrc
|
2021-04-19 10:08:05 +00:00
|
|
|
else
|
2022-12-22 10:18:25 +00:00
|
|
|
source ~/git/dotfiles/hosts/any/bashrc
|
2021-04-19 10:08:05 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-15 07:34:33 +00:00
|
|
|
if type nvim &>/dev/null ; then
|
|
|
|
alias vim=nvim
|
2021-04-19 10:08:05 +00:00
|
|
|
fi
|
2017-11-03 07:09:33 +00:00
|
|
|
|
|
|
|
# LS_COLORS
|
|
|
|
eval $(dircolors -b $HOME/.dircolors)
|
|
|
|
|
|
|
|
# Global Options
|
|
|
|
export LS_OPTIONS=""
|
|
|
|
export LESS='-R'
|
2017-11-03 07:45:03 +00:00
|
|
|
export TERM=xterm-256color
|
2020-03-13 17:00:12 +00:00
|
|
|
export MC_SKIN=$HOME/.mc/lib/solarized.ini
|
2017-11-03 07:09:33 +00:00
|
|
|
|
2022-12-22 10:18:25 +00:00
|
|
|
# Better History
|
2024-01-04 15:28:24 +00:00
|
|
|
export HISTFILE=~/.bash_history
|
|
|
|
export HISTSIZE=10000000
|
|
|
|
export HISTFILESIZE=10000000
|
|
|
|
export HISTTIMEFORMAT="%F %T "
|
|
|
|
export HISTCONTROL='ignorespace:ignoredups'
|
|
|
|
export HISTIGNORE='l:ls:history'
|
|
|
|
|
2022-12-22 10:18:25 +00:00
|
|
|
|
2024-01-04 15:28:24 +00:00
|
|
|
# Don't render ![0-9] as previous command
|
|
|
|
set +o histexpand
|
2022-12-22 10:18:25 +00:00
|
|
|
# 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
|
|
|
|
|
2022-02-15 07:34:33 +00:00
|
|
|
#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 {
|
2022-04-02 13:50:26 +00:00
|
|
|
cat $@ | python3 -c 'import sys, yaml, json; print(yaml.dump(json.loads(sys.stdin.read())))'
|
2022-02-15 07:34:33 +00:00
|
|
|
}
|
2017-11-03 07:09:33 +00:00
|
|
|
|
|
|
|
# Aliases
|
|
|
|
alias ls="ls --color=always --time-style=long-iso -F"
|
2022-02-15 07:34:33 +00:00
|
|
|
alias dfh="df -hT -t ext4 -t zfs -t xfs"
|
2020-03-13 17:05:03 +00:00
|
|
|
alias lsof='lsof 2>/dev/null | grep'
|
2022-12-27 11:01:31 +00:00
|
|
|
alias winekiller="ps -ef | grep 'fusion|wine|\.exe' -E -i | awk '{ print \$2}' | xargs kill -9"
|
2020-03-13 17:05:03 +00:00
|
|
|
|
|
|
|
# Git
|
2017-11-03 07:09:33 +00:00
|
|
|
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"
|
2022-02-14 20:37:02 +00:00
|
|
|
alias gcap="git commit --amend --no-edit && git push -f"
|
2017-11-11 11:36:23 +00:00
|
|
|
|
2020-03-13 17:00:12 +00:00
|
|
|
# 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"
|
|
|
|
|
2021-04-19 10:08:05 +00:00
|
|
|
# Completions for various tools...
|
2022-02-14 20:37:02 +00:00
|
|
|
for bin in kubectl helm clusterctl talosctl flux ; do
|
2021-04-19 10:08:05 +00:00
|
|
|
type $bin &>/dev/null && source <($bin completion bash)
|
|
|
|
done
|