Skip to content

Instantly share code, notes, and snippets.

@sean-d
Last active March 19, 2016 04:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sean-d/74bdc339802a5a8887a8 to your computer and use it in GitHub Desktop.
Save sean-d/74bdc339802a5a8887a8 to your computer and use it in GitHub Desktop.
bash_profile
##################################################################
## file: .bash_profile ##
## version: 1.1 ##
#---------------------------------------------------------------##
## Changlog ##
## ##
## 1.1 ##
## -colorized ps1 ##
## - added table of contents ##
## 1.0 ##
## -formatted original and added a header for tracking changes ##
## Pre 1.0 ##
## -trial and error sorting out a baseline ##
##################################################################
#######################
## Table Of Contents ##
#######################
#---------------------------------------------------------------------#
# Global stuffs: settings that are not domain-specific #
# Bash-git-completion: settings for bash-git-completion brew install #
# Aliases: aliases are found here #
# Python stuff: Python-specific settings #
# Functions: custom-built functions #
#---------------------------------------------------------------------#
###################
## Global stuffs ##
###################
#----------------------------------------------------------------------------------------#
# ARCHFLAGS: set architecture flags #
# PATH: the...path... #
# CLICOLOR: enable cli colorozation #
# LSCOLORS: http://osxdaily.com/2012/02/21/add-color-to-the-terminal-in-mac-os-x/ #
# item2: to enable iterm2 shell itegration #
# ps1: custom bash prompt via kirsle.net/wizards/ps1.html #
#----------------------------------------------------------------------------------------#
export ARCHFLAGS="-arch x86_64"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
#########################
## Bash-git-completion ##
#########################
#------------------------------------------------------------------------------------------------------------#
# GIT_PROMPT_ONLY_IN_REPO: only display git at ps1 when in a repo #
# GIT_PROMPT_FETCH_REMOTE_STATUS=0: fetch remote status #
# GIT_PROMPT_SHOW_UPSTREAM=1: show upstream tracking branch #
# GIT_PROMPT_SHOW_UNTRACKED_FILES=all: can be no, normal or all; determines counting of untracked files #
# GIT_PROMPT_START=... custom prompt start sequence #
# GIT_PROMPT_END=... custom prompt end sequence #
# GIT_PROMPT_THEME=Custom use custom .git-prompt-colors.sh #
# GIT_PROMPT_THEME=Solarized use theme #
#------------------------------------------------------------------------------------------------------------#
GIT_PROMPT_ONLY_IN_REPO=1
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
GIT_PROMPT_THEME=Solarized_Extravagant
source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh"
fi
# bash-completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
##############
## Aliases ##
##############
#------------------------------------------------------------------------------------------------------------#
# udb: updating locatedb #
# vi: vi filename => vim filename #
# htop: htop via sudo #
# eff: the fuck #
# showFinder: show hidden files in finder #
# hideFinder: hide unhidden files in finder #
# findDS: finds all system .DS_Store files resursively (requires root) #
# noDS: disables the creation of .DS_Store files #
# yesDS: enables the creation of .DS_Store files #
# byeDS: deletes all instances of .DS_Store starting at root and working recursively (requires root) #
#------------------------------------------------------------------------------------------------------------#
alias udb='sudo /usr/libexec/locate.updatedb'
alias vi='vim'
alias htop='sudo htop'
alias showFinder='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFinder='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias findDS='sudo find . "-name" ".DS_Store"'
alias noDS='defaults write com.apple.desktopservices DSDontWriteNetworkStores true'
alias yesDS='defaults write com.apple.desktopservices DSDontWriteNetworkStores false'
alias byeDS='sudo find . "-name" ".DS_Store" -exec rm {} \;'
alias eff='eval $(thefuck $(fc -ln -1)); history -r'
alias htop='sudo htop'
##################
## Python Stuff ##
##################
#------------------------------------------------------------#
# WORKON_HOME: virtualenvs reside #
# PROJECT_HOME: python projects reside #
# VIRTUALWRAPPER_PYTHON: brew python binary for venvs #
# PIP_REQUIRE_VIRTUALENV: forces active venv to use pip #
#------------------------------------------------------------#
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/projects
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
source /usr/local/bin/virtualenvwrapper.sh
export PIP_REQUIRE_VIRTUALENV=true
#####################
## Custom functions##
#####################
#--------------------------------------------------------#
# gpip: allow for global pip use #
# bluetooth_on: enables phones to trigger apps #
# bluetooth_off: prevents phones from triggering apps #
#--------------------------------------------------------#
gpip() {
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
bluetooth_on() {
launchctl load -w /System/Library/LaunchAgents/com.apple.rcd.plist
}
bluetooth_off() {
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment