Skip to content

Instantly share code, notes, and snippets.

@James-Newman
Last active January 20, 2021 09:43
Show Gist options
  • Save James-Newman/d78c6b30148b68637aeb24ec96e65161 to your computer and use it in GitHub Desktop.
Save James-Newman/d78c6b30148b68637aeb24ec96e65161 to your computer and use it in GitHub Desktop.
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Remove zsh warning on a mac
export BASH_SILENCE_DEPRECATION_WARNING=1
# Set common colour escape codes
RESTORE="$(echo -e "\033[0m")"
RED="$(echo -e "\033[31m")"
GREEN="$(echo -e "\033[32m")"
YELLOW="$(echo -e "\033[33m")"
BLUE="$(echo -e "\033[34m")"
PURPLE="$(echo -e "\033[35m")"
CYAN="$(echo -e "\033[36m")"
DGREY="$(echo -e "\033[90m")"
LGRAY="$(echo -e "\033[37m")"
LRED="$(echo -e "\033[91m")"
LGREEN="$(echo -e "\033[92m")"
LYELLOW="$(echo -e "\033[93m")"
LBLUE="$(echo -e "\033[94m")"
LPURPLE="$(echo -e "\033[95m")"
LCYAN="$(echo -e "\033[96m")"
WHITE="$(echo -e "\033[97m")"
# Set hold alias
alias hold='while true; do clear; user=`whoami`; host=`uname -n`; now=`date "+%Y-%m-%d %H:%M:%S"`; echo -e "Hello ${LCYAN}${user}${RESTORE}"; echo -e "You are currently connected to ${LPURPLE}${host}${RESTORE}"; echo -e "The time now is ${LGREEN}${now}${RESTORE}"; sleep 30; done'
# Current eth0 ip address
IPADDR=`/sbin/ifconfig en0 | grep "inet " | awk '{print $2}'`
# Set the prompt
PS1="[\[${CYAN}\]\u\[${RESTORE}\]@\[${YELLOW}\]\h\[${RESTORE}\](\[${LPURPLE}${IPADDR}${RESTORE}\])-\[${LCYAN}\]\t\[${RESTORE}]\]\n[\[${LGREEN}\]\w\[${RESTORE}\]]\$ "
# Create docker aliases for easier docking
alias docker-rm='docker rm $(docker ps -qaf "status=exited")'
alias docker-rmall='docker kill $(docker ps -qaf "status=running"); docker rm $(docker ps -qaf "status=exited"); docker rm $(docker ps -qaf "status=created")'
# Virtualenv wrapper setup
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
source /usr/local/bin/virtualenvwrapper_lazy.sh
# Source additional environment credentials
if [ -d ~/.credentials ]; then
for CRED in $(ls ~/.credentials/*)
do
. $CRED
done
fi
# Source additional aliases
if [ -d ~/.aliases ]; then
for ALIAS in $(ls ~/.aliases/*)
do
. $ALIAS
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment