PeterGrillot
2/12/2016 - 7:10 PM

Pete's Bash Profile

Pete's Bash Profile

# -----------------------------------------
#     Welcome to Pete's Bash Profile!
# -----------------------------------------
# If you make changes, make sure 
# to source the changes with:

# source ~/.bash_profile

# Change <username> to your username

# -----------------------------------------
#               Aliases
# -----------------------------------------
# To temporarily bypass an alias
# we can type '\whatever'


# Verbose List Files at current location
alias ll='ls -FGlAhp'

# Verbose List Files at current location
alias sshlogin='ssh brightfind@45.55.149.252'

# Colorful List Files at current location
alias ls='ls -Gp'

# Lazy directory traverse
# up a directory
alias up='cd ../'

# Back to previous directory
alias back='cd -'

# Home directory '~/'
alias home='cd ~'

# Go up 2 directories
alias ...='cd ../../'

# Clear
alias cl='clear'

# Open current location in finder
alias finder='open -a Finder ./'

# Open current folder in Sublime
# alias sub='sublime ./ && open -a Terminal'

# Get External IP address
alias getip='ifconfig en0 inet'

# Get Weather!
alias weather='curl http://wttr.in/Washington'

# Connect to Morph Webs - WORKING ON IT
# alias morph='mount_smbfs smb://PGrillot@192.168.120.206'

alias inforad='cd ~/Development/info-radiator-repo/info-radiator-vue-app/'
# Note `open -a terminal` opens program and/or swtiches to it

# Git! shitty spllling
alias gut='git'

# git status
alias gsts='git status'

# git current branch
alias gb='git rev-parse --abbrev-ref HEAD'

# git checkout
alias gswb='git checkout'

# git new branch
alias gnewb='git checkout -b'

# -----------------------------------------
#                Functons
# -----------------------------------------
# Renamer Files

#find . -depth -name '*findThis*' -execdir bash -c 'mv -i "$1" "${1//findThis/replaceWith}"' bash {} \;

function sub {
  if [ -z $1 ] ; then
    #open Sublime in Current Directory
    sublime ./
  else
    sublime $1
  fi
}
#spin up front-end project w/ sublime and task runner option
function spin {
  if [ -z $1 ] ; then
    #open self
    sublime ./ && open -a Terminal
  elif [ $# == 1 ] ; then
    # open $1
    cd ~/Development/$1 && sublime ./
  elif [ $# == 2 ] ; then
    # open $1 run $2
    cd ~/Development/$1 && sublime ./ && $2
  fi
}

# Make directory and enter it
function createdir {
  mkdir -p $1 && cd $1
}
# Make file and open in Sublime
function createfile {
	touch $1 && sublime $1
}

# rm -r 'directory'
function destroy {
	rm -r $1
}

# Goto Directory with arg as subdirectory
function dev {
  cd ~/Development/$1
}

# Goto TFS Directory with arg as subdirectory
function tfs {
  cd ~/Development/_TFS/$1
}

# More Git
# commit
function gcommit {
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
  echo "You are in <${BRANCH}>, Message:"
  read message
  git add -A && git commit -m "$message"
}

# update from branch
function gmerge {
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
  echo "You are in <${BRANCH}>, Update from where?"
  read message
  git merge --no-ff -m "Update from Develop" $message
}

# push
function gpush {
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
  echo "PUSH: You are in <${BRANCH}>, Push to where?"
  read message
  git push origin $message
}

# pull
function gpull {
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
  echo "PULL: You are in <${BRANCH}>, Pull from where?"
  read message
  git pull origin $message
}

# Extract any file
extract() { 
    if [ -f $1 ] ; then 
      case $1 in 
        *.tar.bz2)   tar xjf $1     ;; 
        *.tar.gz)    tar xzf $1     ;; 
        *.bz2)       bunzip2 $1     ;; 
        *.rar)       unrar e $1     ;; 
        *.gz)        gunzip $1      ;; 
        *.tar)       tar xf $1      ;; 
        *.tbz2)      tar xjf $1     ;; 
        *.tgz)       tar xzf $1     ;; 
        *.zip)       unzip $1       ;; 
        *.Z)         uncompress $1  ;; 
        *.7z)        7z x $1        ;; 
        *)     echo "'$1' cannot be extracted via extract()" ;; 
         esac 
     else 
         echo "'$1' is not a valid file" 
     fi 
}
# Get the weather
function getweather {
	if [ -z $1 ] ; then 
		curl http://wttr.in/Washington
	else
		curl http://wttr.in/$1
	fi
}

# NVM
export NVM_DIR="/Users/petergrillot/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm