Skip to content

Instantly share code, notes, and snippets.

@astleychen
Created October 24, 2018 14:01
Show Gist options
  • Save astleychen/11bcd7c9ab71420ff92ed5a42b68e013 to your computer and use it in GitHub Desktop.
Save astleychen/11bcd7c9ab71420ff92ed5a42b68e013 to your computer and use it in GitHub Desktop.
.bash_profile for macOS
## pyenv Setup
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
alias ll='ls -al'
alias lf='ls -lF'
export CLICOLOR=1
export LSCOLORS=GxBxCxDxexegedabagaced
## Git branch info
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
## Kubectl current context
k8s_current_context() {
CONTEXT=$(cat ~/.kube/config | grep "current-context:" | sed "s/current-context: //")
if [ -n "$CONTEXT" ]; then
echo "[${CONTEXT}]"
fi
}
export PS1="\[\033[1;33m\]\$(k8s_current_context) \[\033[32m\]\W\[\033[31m\]\$(parse_git_branch)\[\033[0m\] \$ "
# Location of Go workspace
export GOPATH=~/Workspaces/go
export PATH=$PATH:$GOPATH/bin
## gcloud SDK Setup
# Using python 2 as default
export CLOUDSDK_PYTHON=python2
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/Astley/Workspaces/gcloud-sdk/path.bash.inc' ]; then . '/Users/Astley/Workspaces/gcloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/Astley/Workspaces/gcloud-sdk/completion.bash.inc' ]; then . '/Users/Astley/Workspaces/gcloud-sdk/completion.bash.inc'; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment