Skip to content

Instantly share code, notes, and snippets.

@jonniedarko
Last active September 8, 2016 12:54
Show Gist options
  • Save jonniedarko/7ce83b1ca9db24549ffd to your computer and use it in GitHub Desktop.
Save jonniedarko/7ce83b1ca9db24549ffd to your computer and use it in GitHub Desktop.
# for changes to file
alias reloadBash='source ~/.bash_profile'
alias editBash='subl ~/.bash_profile'
#mongo
alias mongod='mongod --dbpath ~/data/db'
# open in chrome
alias chrome='open -a "Google Chrome"'
#alias cp='cp -iv' # Preferred 'cp' implementation
alias mv='mv -iv' # Preferred 'mv' implementation
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
alias ll='ls -FGlAhp' # Preferred 'ls' implementation
alias less='less -FSRXc' # Preferred 'less' implementation
cd() { builtin cd "$@" && ls; } # Always list directory contents upon 'cd'
alias cd..='cd ../' # Go back 1 directory level (for fast typers)
alias ..='cd ../' # Go back 1 directory level
alias ...='cd ../../' # Go back 2 directory levels
alias .3='cd ../../../' # Go back 3 directory levels
alias .4='cd ../../../../' # Go back 4 directory levels
alias .5='cd ../../../../../' # Go back 5 directory levels
alias .6='cd ../../../../../../' # Go back 6 directory levels
alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less'
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias clearDNSCache='sudo dscacheutil -flushcache';
function chmod-num {
echo "
rwx chmod rwx chmod
----- ------- ----- -------
000 0 100 4
001 1 101 5
010 2 110 6
011 3 111 7
"
}
alias gl='git log --oneline --graph --decorate --all'
alias glp='git log --graph --abbrev-commit --decorate --date=relative --all'
alias gs='git status'
alias gll='git log origin/HEAD..HEAD'
alias gr='git pull --rebase origin master'
set-git-proxy(){
git config --global http.proxy $PROXY
git config --global https.proxy $PROXY
}
unset-git-proxy(){
git config --global --unset http.proxy
git config --global --unset https.proxy
}
git-nossh(){
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
}
# ingores Duplicates in command history
export HISTCONTROL=ignoredups
# regular colors
export tc_black='\[\e[0;30m\]' # black
export tc_red='\[\e[0;31m\]' # red
export tc_green='\[\e[0;32m\]' # green
export tc_yellow='\[\e[0;33m\]' # yellow
export tc_blue='\[\e[0;34m\]' # blue
export tc_purple='\[\e[0;35m\]' # purple
export tc_cyan='\[\e[0;36m\]' # cyan
export tc_white='\[\e[0;37m\]' # white
export default_color="\[\033[0m\]" # default color
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
terminal_line(){
c=$COLUMNS
for ((i=0; i<c; i++)); do
printf "_"
done
}
# Change Prompt
# ------------------------------------------------------------
export PS1="${tc_purple}\$(terminal_line)\n${default_color}| \u $tc_blue @ $default_color\h $tc_red in $default_color\w : \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] \n| $tc_cyan=>$default_color "
export PS2="| =>"
# This will set the title of the current terminal tab to the name of the folder you are in (NOT the whole path).
PROMPT_COMMAND='echo -ne "\033]0; ${PWD##*/}\007"'
# for changes to file
alias reloadBash='source ~/.bash_profile'
alias editBash='subl ~/.bash_profile'
# brew cask
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
# node, npm & nvm
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
#external npm
alias enpm='npm --registry http://registry.npmjs.org'
# interal npm
#alias npm='npm --registry http://customregistry'
# mongodb
alias mongod='mongod --dbpath ~/data/db'
# webstorm
alias webstorm='open -a /Applications/WebStorm.app'
# rabbitmq-server
alias rabbitmq='/usr/local/sbin/rabbitmq-server'
# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
export LESS=-FX
# aliases
alias cp='cp -iv' # Preferred 'cp' implementation
alias mv='mv -iv' # Preferred 'mv' implementation
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
alias ll='ls -FGlAhp' # Preferred 'ls' implementation
alias less='less -FSRXc' # Preferred 'less' implementation
#cd() { builtin cd "$@"; ll; } # Always list directory contents upon 'cd'
cd() { builtin cd "$@" && ls; }
alias cd..='cd ../' # Go back 1 directory level (for fast typers)
alias ..='cd ../' # Go back 1 directory level
alias ...='cd ../../' # Go back 2 directory levels
alias .3='cd ../../../' # Go back 3 directory levels
alias .4='cd ../../../../' # Go back 4 directory levels
alias .5='cd ../../../../../' # Go back 5 directory levels
alias .6='cd ../../../../../../' # Go back 6 directory levels
alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less'
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias clearDNSCache='sudo dscacheutil -flushcache';
#proxy
export proxy="http://proxyurl:port"
export http_proxy=$proxy
export https_proxy=$proxy
export PROXY=$proxy
export HTTP_PROXY=$proxy
export HTTPS_PROXY=$proxy
#export no_proxy="127.0.0.1, localhost"
#export no-proxy="127.0.0.1, localhost"
#export NO_PROXY="127.0.0.1, localhost"
#export NO-PROXY="127.0.0.1, localhost"
# default node
set-npm-proxy(){
npm config --global set proxy http://proxyurl:port
npm config --global set https-proxy http://proxyurl:port
}
unset-npm-proxy(){
npm config --global delete proxy
npm config --global delete https-proxy
}
set-proxy(){
export proxy="http://proxyurl:port"
export http_proxy=$proxy
export https_proxy=$proxy
export PROXY=$proxy
export HTTP_PROXY=$proxy
export HTTPS_PROXY=$proxy
export no_proxy="127.0.0.1, localhost"
echo "proxy set: $proxy"
set-npm-proxy
set-git-proxy
}
unset-proxy(){
unset proxy
unset http_proxy
unset https_proxy
unset PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
unset-npm-proxy
unset-git-proxy
}
git-user-work(){
git config user.email "work email"
git config user.name "work name"
}
git-user-home(){
git config user.email "email"
git config user.name "name"
}
#Java
export JAVA7_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk"
export JAVA6_HOME="/Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home"
export JAVA_HOME=$JAVA6_HOME
# android tools
export ANDROID_TOOLS='/Applications/Android Studio.app/sdk/tools'
export ANDROID_PLATFORM_TOOLS='/Applications/Android Studio.app/sdk/platform-tools'
# PATH
export lOCAL_PATH=/usr/local/bin
#export PATH=$JAVA_HOME/bin:$lOCAL_PATH:$PATH:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
export PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH
export PATH="/usr/local/sbin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment