Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Last active July 22, 2019 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badsyntax/ecd9bc7cfe0b74c5e3d49a057848459b to your computer and use it in GitHub Desktop.
Save badsyntax/ecd9bc7cfe0b74c5e3d49a057848459b to your computer and use it in GitHub Desktop.
# Getting started
# 1. Install homebrew: https://brew.sh/
# 2. Install nvm: https://github.com/nvm-sh/nvm
# 3. Install other stuff:
# brew install bash-completion
# brew install git
# brew install lolcat
# brew install bash (then folllow instructions here: https://apple.stackexchange.com/a/292760)
# 4. Run: echo "source ./.bashrc" > ~/.bash_profile
# 5. Open a new iterm window
function welcome() {
local user=$(whoami)
local host=$(hostname)
echo "Welcome $user!" | lolcat --freq 0.5
}
function setup-bash() {
shopt -s autocd
}
function setup-nvm() {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
}
function setup-prompt() {
if [ -f "$(brew --prefix)/etc/bash_completion" ]; then
. $(brew --prefix)/etc/bash_completion
fi
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWCOLORHINTS=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export PS1='\[\033[32m\]\u\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n$ '
}
function setup-aliases() {
alias ls='ls -GF'
alias grep="grep --color=auto"
alias git-current-branch="git rev-parse --abbrev-ref HEAD"
}
function git-set-upstream() {
local CURRENT_BRANCH=$(git-current-branch)
git branch --set-upstream-to=origin/"$CURRENT_BRANCH" "$CURRENT_BRANCH"
}
function check_port(){
lsof -i :$1
}
setup-aliases
setup-bash
setup-prompt
setup-nvm
welcome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment