Last active
December 12, 2015 02:08
-
-
Save mohsen1/4696114 to your computer and use it in GitHub Desktop.
My bash_profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########### | |
# Aliases # | |
########### | |
alias ll='ls -l' | |
alias js='node' | |
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl' | |
alias ls='ls -G' | |
alias gadd="git add .; git add -u .; git status;" | |
alias nook='cd ~/Projects/NookWeb/nook.com' | |
# Folder aliases | |
alias cd..='cd ..' | |
alias ..='cd ..' | |
alias ...='cd ../../' | |
alias ....='cd ../../../' | |
alias .4='cd ../../../../' | |
alias .5='cd ../../../../../' | |
alias .6='cd ../../../../../../' | |
alias .7='cd ../../../../../../../' | |
alias .8='cd ../../../../../../../../' | |
alias psax="ps ax | grep --color " | |
alias myip="ifconfig | grep 'inet '" | |
############# | |
# Functions # | |
############# | |
# Google it! (or google that) | |
google() | |
{ | |
local s="$_" | |
local query= | |
case "$1" in | |
'') ;; | |
that) query="search?q=${s//[[:space:]]/+}" ;; | |
*) s="$*"; query="search?q=${s//[[:space:]]/+}" ;; | |
esac | |
echo open /Applications/Google\ Chrome\ Canary.app/ "http://www.google.com/${query}" | |
} | |
# Quickly add a new alias with description (and auto source update) | |
function adal { | |
desc="ADD DESCRIPTION..." | |
if [ -n "$3" ]; then | |
desc="$3" | |
fi | |
echo "" >> ~/.bash_aliases | |
echo "###" >> ~/.bash_aliases | |
echo "## | |
$desc" >> ~/.bash_aliases | |
echo "#" >> ~/.bash_aliases | |
echo "" >> ~/.bash_aliases | |
echo "alias '$1'='$2'" >> ~/.bash_aliases | |
source ~/.bash_aliases | |
echo "" && echo "- Alias added -" && echo "" | |
} | |
function md () { mkdir -p $1; cd $1; } | |
########### | |
# For Fun # | |
########### | |
alias please="sudo" | |
alias shit='printf "Everything is going to be alright ⚘\n";' | |
alias fixairplay="sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`" | |
################# | |
# Command Promt # | |
################# | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" | |
local WHITE="\[\033[1;37m\]" | |
local LIGHT_GRAY="\[\033[0;37m\]" | |
case $TERM in | |
xterm*) | |
TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
;; | |
esac | |
PS1="\w$WHITE $LIGHT_GREEN\$(parse_git_branch)$BLUE ▶ $LIGHT_GRAY" | |
PS2='> ' | |
PS4='+ ' | |
} | |
proml | |
###################### | |
# Rails and Ruby stuff | |
###################### | |
source ~/.rvm/scripts/rvm | |
alias be='bundle exec' | |
alias prodnj="be rake nook:switch_services[fake-prod-nj]" | |
alias precommit="sourcce ~/.precommit" | |
ipfw add 1 forward 127.0.0.1,3000 ip from any to any 80 in | |
################ | |
# Update Local | |
################ | |
wget --output-document=$HOME/Dropbox/snippests/bash_profile https://gist.github.com/raw/4696114/ | |
clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment