Skip to content

Instantly share code, notes, and snippets.

@randombrein
Created June 15, 2014 19:03
Show Gist options
  • Save randombrein/94390009ca685a18916f to your computer and use it in GitHub Desktop.
Save randombrein/94390009ca685a18916f to your computer and use it in GitHub Desktop.

Revisions

  1. randombrein created this gist Jun 15, 2014.
    117 changes: 117 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,117 @@
    export CLICOLOR=1
    export LSCOLORS=ExFxCxDxBxegedabagacadexport
    export PATH="$HOME/bin:$PATH"
    export PATH="/usr/local/bin:$PATH"
    export PATH="/usr/local/sbin:$PATH"


    alias ll='ls -l'
    alias nano='nano -m -S'
    alias subl="'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'"

    #####
    # MAC OS X default locale
    # http://stackoverflow.com/questions/1830394/python-locale-strange-error-whats-going-on-here-exactly
    ####
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8



    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

    ### MYSQL
    export PATH="$PATH:/usr/local/mysql/bin"
    export MYSQL_HOME=/usr/local/mysql
    alias mysql_start='$MYSQL_HOME/bin/mysqld_safe &'
    alias mysql_stop='$MYSQL_HOME/bin/mysqladmin shutdown'
    ### MYSQL

    # Setting PATH for Python 3.3
    # The orginal version is saved in .bash_profile.pysave
    # PATH="/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}"
    # export PATH
    # PYTHONPATH
    export PYTHONPATH="$HOME/pythonWorkspace:$PYTHONPATH"
    export PYTHONPATH="$HOME/djangoWorkspace:$PYTHONPATH"

    # PYTHONPATH(brew)
    export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

    #PYTHONSTARTUP
    export PYTHONSTARTUP="$HOME/.pythonrc.py"

    #Posgres.app PATH
    export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

    #http://matlads.blogspot.com/2012/09/tweaking-psql-in-color.html
    export PAGER=less
    export LESS="-iMSx4-FX"
    psql() {
    YELLOW=$(printf "\e[1;33m" )
    LIGHT_CYAN=$(printf "\e[1;36m" )
    NOCOLOR=$(printf "\e[0m" )

    export LESS="-iMSx4 -FXR"

    PAGER="sed \"s/\([[:space:]]\+[0-9.\-]\+\)$/${LIGHT_CYAN}\1$NOCOLOR/;"
    PAGER+="s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/${LIGHT_CYAN}\1$NOCOLOR/g;"
    PAGER+="s/|/$YELLOW|$NOCOLOR/g;s/^\([-+]\+\)/$YELLOW\1$NOCOLOR/\" 2>/dev/null | less"
    export PAGER

    env psql "$@"
    unset LESS PAGER
    }

    #Bedzzle your bash prompt with git info
    #http://www.railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
    function parse_git_branch {
    ref=$(git symbolic-ref HEAD 2> /dev/null) || return
    echo "("${ref#refs/heads/}") "
    }

    RED="\[\033[01;31m\]"
    YELLOW="\[\033[01;33m\]"
    GREEN="\[\033[01;32m\]"
    BLUE="\[\033[01;34m\]"
    DEF_COLOR="\[\033[00m\]"

    #PS1="\w \$(parse_git_branch)\$ "
    PS1="$BLUE\$(parse_git_branch)$RED[$USER]$GREEN\W/ $YELLOW: $DEF_COLOR"

    ######################
    # Git Shortcuts
    # https://gist.github.com/ralfebert/515937
    ######################

    # Prompt
    export GIT_PS1_SHOWDIRTYSTATE=1

    # Editor
    export GIT_EDITOR='nano -Y patch'

    # Creates git repostitory with some reasonable default settings in current folder
    function git_here() {
    git init
    git config color.ui auto
    echo "log tmp db/*.sqlite3 nbproject/private bin .DS_Store" | tr " " "\n" > .gitignore
    git add .gitignore
    git commit -m "initial project setup"
    }

    alias d='git diff --word-diff $@'
    alias s='d;git status -sb'
    alias b='git branch -avv'
    alias a='git add $@'
    alias c='git commit -v $@'
    alias ac='git add .;c $@'
    alias lg='git lg'


    #Qunused-arguments error
    #http://stackoverflow.com/a/22322645/644258
    #export CFLAGS=-Qunused-arguments
    #export CPPFLAGS=-Qunused-arguments

    #swift [beta env]
    alias swift='/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk'