Last active
August 12, 2019 12:37
-
-
Save Shrikant9/fb9e78d7bf887d9dbe3d4c74c42429f8 to your computer and use it in GitHub Desktop.
A copy of my bash_profile so I don't have to set all of it up again and again on new systems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the default .profile | |
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" | |
# Exports | |
export PATH="/usr/local/opt/openssl/bin:$PATH" | |
export PATH="/usr/local/opt/openssl/bin:$PATH" | |
export MYSQL="/usr/local/mysql/bin" | |
export PATH=$PATH:$MYSQL | |
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH | |
export GOROOT="/usr/local/go" | |
export GOPATH="/Users/home/gopath" | |
export PATH="/Users/home/gopath/bin:$PATH" | |
export NODE_ENV="development" | |
# Aliases | |
alias gitlog="git log --pretty=tformat:'%C(Yellow)%h %Cred(%cr)%Creset: %s'" | |
alias u='cd ..' | |
alias la='ls -l -a' | |
alias yarnCoverage='yarn test:coverage && open coverage/lcov-report/index.html' | |
alias deleteMergedBranches='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d' | |
alias deleteLocalBranches='git co master && git branch | grep -Ev "(^|\s)master($|\s)" | xargs git branch -D' | |
alias gitStashAll='git stash --all' | |
# get current branch in git repo | |
function parse_git_branch() { | |
BRANCH=$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
if [ ! "${BRANCH}" == "" ]; then | |
STAT=$(parse_git_dirty) | |
echo "(${BRANCH})" | |
else | |
echo "" | |
fi | |
} | |
# get current status of git repo | |
function parse_git_dirty() { | |
status=$(git status 2>&1 | tee) | |
dirty=$( | |
echo -n "${status}" 2>/dev/null | grep "modified:" &>/dev/null | |
echo "$?" | |
) | |
untracked=$( | |
echo -n "${status}" 2>/dev/null | grep "Untracked files" &>/dev/null | |
echo "$?" | |
) | |
ahead=$( | |
echo -n "${status}" 2>/dev/null | grep "Your branch is ahead of" &>/dev/null | |
echo "$?" | |
) | |
newfile=$( | |
echo -n "${status}" 2>/dev/null | grep "new file:" &>/dev/null | |
echo "$?" | |
) | |
renamed=$( | |
echo -n "${status}" 2>/dev/null | grep "renamed:" &>/dev/null | |
echo "$?" | |
) | |
deleted=$( | |
echo -n "${status}" 2>/dev/null | grep "deleted:" &>/dev/null | |
echo "$?" | |
) | |
bits='' | |
if [ "${renamed}" == "0" ]; then | |
bits=">${bits}" | |
fi | |
if [ "${ahead}" == "0" ]; then | |
bits="*${bits}" | |
fi | |
if [ "${newfile}" == "0" ]; then | |
bits="+${bits}" | |
fi | |
if [ "${untracked}" == "0" ]; then | |
bits="?${bits}" | |
fi | |
if [ "${deleted}" == "0" ]; then | |
bits="x${bits}" | |
fi | |
if [ "${dirty}" == "0" ]; then | |
bits="!${bits}" | |
fi | |
if [ ! "${bits}" == "" ]; then | |
echo " ${bits}" | |
else | |
echo "" | |
fi | |
} | |
#export PATH="$PATH:$HOME/.rvm/bin" | |
export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh | |
export PS1="\[\e[31m\]\W\[\e[m\] \[\e[33m\]\`parse_git_branch\`\[\e[m\] \[\e[37m\]⇨\[\e[m\] " | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
export PATH=$PATH:/Users/home | |
export SLACK_THEME_SHELL_PROFILE="/Users/home/.bash_profile" | |
function kill_process_on_port() { | |
if [ ! -z "$1" ]; then | |
kill $(lsof -t -i :"$1") | |
else | |
echo "No argument supplied" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment