Skip to content

Instantly share code, notes, and snippets.

@abenrob
Forked from philopian/gist:be9f3e18292f9f9194d1
Last active October 11, 2016 11:51
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 abenrob/fc1dbddde4bb17d62816 to your computer and use it in GitHub Desktop.
Save abenrob/fc1dbddde4bb17d62816 to your computer and use it in GitHub Desktop.
#bash_profile location: ~/.bash_profile
# Setting for the UTF-8 terminal support
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# clean up terminal prompt
PS1="[\W] \u $ "
# open python server on 8000
alias pyserver='python -m SimpleHTTPServer '
# copy current path
alias getpath='echo -n $PWD|pbcopy|echo "...current path copied to clipboard"'
# pretty git log
alias gitlog='git log --pretty=format:"%h %s" --graph'
# colorful git log
alias brlog='git log --oneline --decorate --all'
# allow git tab completion
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
# open chrome fresh, or with a specific url
# 'chrome "http://www.google.com"' -OR- 'chrome'
openChrome() {
/usr/bin/open -a "/Applications/Google Chrome.app" $1
}
alias chrome=openChrome
openFirefox() {
/usr/bin/open -a "/Applications/Firefox.app" $1
}
alias ff=openFirefox
openSafari() {
/usr/bin/open -a "/Applications/Safari.app" $1
}
alias safari=openSafari
openAll() {
/usr/bin/open -a "/Applications/Google Chrome.app" $1
/usr/bin/open -a "/Applications/Firefox.app" $1
/usr/bin/open -a "/Applications/Safari.app" $1
}
alias all=openAll
# initialize repo, and pull in master
# 'gitset https://github.com/user/repo.git'
gitset() {
if [ $# -eq 0 ]; then
echo "No repo url provided"
exit 1
fi
git init
git remote add origin $1
git pull origin master
}
gitfreshcopy() {
if [ $# -eq 0 ]; then
echo "No branch name provided"
return
fi
curbranch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$curbranch" != "master" ]; then
echo "Not on master branch"
return
fi
printf "You are about to make a fresh copy of branch 'master',\noverwriting branch '$1' both locally and on the server.\nThis is irreversible - are you sure you would like proceed? (y/n): "
read proceed
if [ "$proceed" != "y" ]; then
echo "exiting..."
return
fi
git branch -D $1
git checkout -b $1
git push -f origin $1
git checkout master
}
# remove git components
gitkill() {
rm -rf .git
rm -rf .gitignore
}
# set default javascript/node.js gitignore
setignore() {
rm -rf .gitignore
touch .gitignore
echo "## generic ##" >> .gitignore
echo "*~" >> .gitignore
echo "*.lock" >> .gitignore
echo "*.DS_Store" >> .gitignore
echo "*._*" >> .gitignore
echo "Thumbs.db" >> .gitignore
echo "" >> .gitignore
echo "## Jetbrains ##" >> .gitignore
echo "*.iml" >> .gitignore
echo ".idea/" >> .gitignore
echo "" >> .gitignore
echo "## VSCode ##" >> .gitignore
echo ".vscode/" >> .gitignore
echo "" >> .gitignore
echo "## NodeJS ##" >> .gitignore
echo "node_modules" >> .gitignore
echo "logs" >> .gitignore
echo "*.log" >> .gitignore
echo "" >> .gitignore
echo "## SASS ##" >> .gitignore
echo "**/.sass-cache/*" >> .gitignore
}
# open calculator
openCalc() {
/usr/bin/open -a "/Applications/Calculator.app"
}
alias calc=openCalc
openPreview() {
/usr/bin/open -a "/Applications/Preview.app" $1
}
alias prev=openPreview
getDims() {
/Users/adam/projects/customutils/getImgSize/getImgSize.py $1
}
portKill() {
if [ -z "$1" ]; then
echo "Usage: portKill [numeric port identifier]" >&2
return 1
fi
lsof -i TCP:$1 | awk '/LISTEN/{print $2}' | xargs kill -9
echo "Port" $1 "found and killed."
}
amiconnected() {
curl -ks https://api.github.com/users/abenrob || printf
}
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/bin/bin:$PATH"
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment