Skip to content

Instantly share code, notes, and snippets.

@ahsquared
Last active February 1, 2017 16:22
Show Gist options
  • Save ahsquared/a2443aaf4233571da765ad155a839bd8 to your computer and use it in GitHub Desktop.
Save ahsquared/a2443aaf4233571da765ad155a839bd8 to your computer and use it in GitHub Desktop.
bash profile for OSX
### MY ALIASES ###
##################
# git command autocompletion script
# source ~/bin/git-completion.bash
# clear screen
alias cls='clear'
# git commands simplified
alias gst='git status'
alias gck='git checkout'
alias gcm='git commit -m'
alias grb='git rebase'
alias gbr='git branch'
alias glg='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias glg2='git log --date-order --all --graph --name-status --format="%C(green)%H%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias gf='git fetch'
alias gplod='git pull origin develop'
alias gpsod='git push origin develop'
alias gploh='git pull origin HEAD'
alias gpsoh='git push origin HEAD'
# fab alias
alias fabdd='fab deploy:develop'
alias fabds='fab deploy:staging'
# ls alias for color-mode
# alias ls='ls -lhoG'
alias lsa='ls -lhaG'
alias lss='ls -x'
# lock computer
alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'
# up 'n' folders
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# simple ip
alias ip='ifconfig | grep "inet " | grep -v 127.0.0.1'
# more details
alias ip1="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# external ip
alias ipext="curl -s http://ipecho.net/plain | awk '{print $1}'"
# grep with color
alias grep='grep --color=auto'
# proxy tunnel
#alias proxy='ssh -D XXXX -p XXXX USER@DOMAIN'
# ssh home
#alias sshome='ssh -p XXXX USER@DOMAIN'
# processes
#alias ps='ps -ax'
# gcc
# alias gcc='./usr/local/Cellar/gcc/4.8.2/bin/gcc'
# refresh shell
alias reload='source ~/.bash_profile'
###############################
### FUNCTIONS ###
###############################
function cs () {
cd $1
ls
}
site(){
cd ~/Sites/$1
}
_site()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(/bin/ls ~/Sites/)" -- $cur) )
}
complete -F _site site
function wavtoogg () {
ffmpeg -i $1 -acodec libvorbis -q:a 2 ${1%%.*}.ogg
}
function wavtomp3 () {
ffmpeg -i $1 -acodec libmp3lame -q:a 5 ${1%%.*}.mp3
}
function convertwav () {
wavtoogg $1
wavtomp3 $1
}
function makevideo () {
ffmpeg -r 29.97 -i "$1" -c:v libx264 -pix_fmt yuv420p ${1%%_\%*}-small.mp4
}
function combineaudio () {
sox -M "$1*.ogg" "$1-mix.wav" remix -m 1v0.7,2v0.9,3v0.4 1v0.7,2v0.4,3v0.9
convertwav "$1-mix.wav"
}
###############################
### ENVIRONMENTAL VARIABLES ###
###############################
#Add MAMP binaries to path
source ~/wp-completion.bash
export PATH=$PATH:/usr/local/go/bin
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
# export MAGICK_HOME="$HOME/ImageMagick-7.0.1"
# export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
# $MAGICK_HOME/bin -- add this to path
export PATH="/Applications/Hugin/PTBatcherGUI.app/Contents/MacOS/:~/pngquant:/opt/ImageMagick/bin:~/android-sk-macosx/tools/:/Applications/Blender/Blender.app/Contents/MacOS/:/usr/local/git/bin:~/imageOptim-cli/bin:/usr/local/bin:usr/bin:/Applications/MAMP/library/bin:/Applications/MAMP/bin/php/php/7.0.10/bin:/Users/ahayter/Documents/Projects/sox-14.4.1:$PATH:$HOME/Library/Haskell/bin:$PATH:/usr/bin"
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PS1="\[\033[1;34m\]\h\[\033[0m\]:\[\033[1;35m\]\u\[\033[0m\]: \[\033[0;33m\]\W\[\033[0m\]$ "
PATH=$PATH:/Applications/VirtualBox.app/Contents/MacOS
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
export NVM_DIR="/Users/ahayter/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# Setting path for brew vim
PATH="/usr/local/Cellar/vim:${PATH}"
# sox - audio mixing cli tool
PATH="/Users/ahayter/sox-14.4.2:${PATH}"
export PATH
## GIT bash prompt
# On Bash Ubuntu Windows Need to do
# sed -i 's/\r$//' ~/.bash-git-prompt/*
# sed -i 's/\r$//' ~/.bash-git-prompt/themes/*
# Set config variables first
GIT_PROMPT_ONLY_IN_REPO=0
# GIT_PROMPT_FETCH_REMOTE_STATUS=0 # uncomment to avoid fetching remote status
# GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
# GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files
# GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files
# GIT_PROMPT_START=... # uncomment for custom prompt start sequence
# GIT_PROMPT_END=... # uncomment for custom prompt end sequence
# GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
# as last entry source the gitprompt script
source ~/.bash-git-prompt/gitprompt.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment