Skip to content

Instantly share code, notes, and snippets.

@kthy
Created February 28, 2024 10:29
Show Gist options
  • Save kthy/6617abb65dda51ab54296d8d65fd4f69 to your computer and use it in GitHub Desktop.
Save kthy/6617abb65dda51ab54296d8d65fd4f69 to your computer and use it in GitHub Desktop.
Bash setup @ SPARK
# add Windows host DNS entry
if ! $(cat /etc/hosts | grep -q 'winhost'); then
echo 'Adding DNS entry for Windows host in /etc/hosts'
echo '# Windows host - added via ~/.bashrc' | sudo tee -a /etc/hosts
echo -e "$(grep nameserver /etc/resolv.conf | awk '{print $2, " winhost"}')" | sudo tee -a /etc/hosts
fi
# configure Cargo
. "$HOME/.cargo/env"
# configure pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# configure NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# start cron and rsyslog
service rsyslog status || sudo service rsyslog start
service cron status || sudo service cron start
# update packages
[ -e "/home/kristian/.pls_run_apt" ] && sudo apt-get update && sudo apt-get upgrade -qq && sudo apt-get autoremove && sudo apt-get autoclean && rm /home/kristian/.pls_run_apt
# fuck those cows
export ANSIBLE_NOCOWS=1
# activate justfile completions when entering directory
# cf. <https://stackoverflow.com/a/21163254/606576>
function just_cd() {
cd $@ && [ -f "justfile" -o -f ".justfile" ] && source <(just --completions bash)
}
# enable just autocompletion
alias cd="just_cd"
# shortcut for updating packages
alias up2d="sudo apt-get update && sudo apt-get upgrade -qq && sudo apt-get autoremove && sudo apt-get autoclean"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment