Skip to content

Instantly share code, notes, and snippets.

@arleym
Created June 10, 2014 19:37
Show Gist options
  • Save arleym/852aab7ec6ef04ea2ac5 to your computer and use it in GitHub Desktop.
Save arleym/852aab7ec6ef04ea2ac5 to your computer and use it in GitHub Desktop.
Bashrc
# Colors! http://misc.flogisoft.com/bash/tip_colors_and_formatting
txtblk='\[\033[0;30m\]' # Black - Regular
txtgry='\[\033[1;30m\]' # Dark Grey
txtmgry='\[\033[38;5;238m\]' # Mid Grey
txtred='\[\033[0;31m\]' # Red
txtgrn='\[\033[0;32m\]' # Green
txtylw='\[\033[0;33m\]' # Yellow
txtblu='\[\033[0;34m\]' # Blue
txtliteblue='\e[94m\]' # Light blue
txtpur='\[\033[0;35m\]' # Purple
txtcyn='\[\033[0;36m\]' # Cyan
txtwht='\[\033[0;37m\]' # White
bldblk='\[\033[1;30m\]' # Black - Bold
bldred='\[\033[1;31m\]' # Red
bldgrn='\[\033[1;32m\]' # Green
bldylw='\[\033[1;33m\]' # Yellow
bldblu='\[\033[1;34m\]' # Blue
bldpur='\[\033[1;35m\]' # Purple
bldcyn='\[\033[1;36m\]' # Cyan
bldwht='\[\033[1;37m\]' # White
unkblk='\[\033[4;30m\]' # Black - Underline
undred='\[\033[4;31m\]' # Red
undgrn='\[\033[4;32m\]' # Green
undylw='\[\033[4;33m\]' # Yellow
undblu='\[\033[4;34m\]' # Blue
undpur='\[\033[4;35m\]' # Purple
undcyn='\[\033[4;36m\]' # Cyan
undwht='\[\033[4;37m\]' # White
bakblk='\[\033[40m\]' # Black - Background
bakred='\[\033[41m\]' # Red
badgrn='\[\033[42m\]' # Green
bakylw='\[\033[43m\]' # Yellow
bakblu='\[\033[44m\]' # Blue
bakpur='\[\033[45m\]' # Purple
bakcyn='\[\033[46m\]' # Cyan
bakwht='\[\033[47m\]' # White
txtrst='\[\033[0m\]' # Text Reset
# Whether the last command was successful
# Erm: http://japaneseemoticons.net/all-japanese-emoticons/
# Fav: ಠ﹏ಠ
# Mmmm: o͡͡͡͡͡͡͡͡͡͡͡͡͡͡╮༼;´༎ຶ.̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̨̨̨̨̨̨̨̨̨̨̨̨.̸̸̨̨۝ ༎ຶ༽╭o͡͡͡͡͡͡͡͡͡͡͡͡͡͡\
success="if [ \$? = 0 ]; then echo \"🚀 ◕ ‿ ◕ 🚀\"; else echo \"🔥 ಠ﹏ಠ 🔥\"; fi"
#Console display
PS1="\n\n\n${txtmgry} 🔱 🔱 🔱 🔱 🔱 🔱 🔱 🔱 🔱 \`${success}\` 🔱 🔱 🔱 🔱 🔱 🔱 🔱 🔱 🔱 \n\n\n\n😱 ${undgrn}\u ${txtgrn}\t ${bldblu}\w 🐝 ${txtrst}\\n$ "
# Bash completion O.O
# /$$$$$$ /$$ /$$ /$$
# /$$__ $$| $$ | $$ | $$
# | $$ \__/| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$
# | $$$$$$ | $$__ $$ /$$__ $$ /$$__ $$|_ $$_/ /$$_____/| $$ | $$|_ $$_/ /$$_____/
# \____ $$| $$ \ $$| $$ \ $$| $$ \__/ | $$ | $$ | $$ | $$ | $$ | $$$$$$
# /$$ \ $$| $$ | $$| $$ | $$| $$ | $$ /$$| $$ | $$ | $$ | $$ /$$\____ $$
# | $$$$$$/| $$ | $$| $$$$$$/| $$ | $$$$/| $$$$$$$| $$$$$$/ | $$$$//$$$$$$$/
# \______/ |__/ |__/ \______/ |__/ \___/ \_______/ \______/ \___/ |_______/
#Open apps
alias subl="open -a 'Sublime Text 2'"
$ subl file
#Go-to places
alias where?='pwd'
alias dropbox='cd /Users/arleym/Dropbox'
alias bowerfavs='cd /Users/arleym/Dropbox/web/_source/Favourites'
alias desktop='cd /Users/arleym/desktop'
#Utilites
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'
#Edit weird system stuff
alias bashrc='subl /Users/arleym/Dropbox/appdata/.bashrc'
alias bashprofile='subl /Users/arleym/.bash_profile'
alias hosts='sudo nano /etc/hosts'
alias allthethings="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
alias chromedev='open -a "/Applications/Google Chrome.app" --args --allow-file-access-from-files' # Quit Chrome first
#Dumb
alias awesome='say high five brosef!'
alias crap='say sucks man, sorry bro.'
alias starwars='telnet towel.blinkenlights.nl'
alias nyan='telnet nyancat.dakko.us'
# FROM MATT
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# [[ -s /Users/amcblain/.nvm/nvm.sh ]] && . /Users/amcblain/.nvm/nvm.sh # This loads NVM
# This load regular profile
. ~/.profile
# ENVIRONMENT CONFIGURATION
# Change Prompt
export PS2="| => "
# Set Paths
export PATH="$PATH:/usr/local/bin/"
export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
# Set Default Editor (change 'Nano' to the editor of your choice)
export EDITOR=/usr/bin/nano
# Set default blocksize for ls, df, du
# from this: http://hints.macworld.com/comment.php?mode=view&cid=24491
export BLOCKSIZE=1k
alias ls='ls -hFG'
alias grep='grep --color=auto'
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'
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 f='open -a Finder ./' # f: Opens current directory in MacOS Finder
alias ~="cd ~" # ~: Go Home
alias b="cd -"
alias c='clear' # c: Clear terminal display
alias which='type -all' # which: Find executables
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
alias show_options='shopt' # Show_options: display bash options settings
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up
alias cic='set completion-ignore-case On' # cic: Make tab-completion case-insensitive
mcd () { mkdir -p "$1" && cd "$1"; } # mcd: Makes new Dir and jumps inside
trash () { command mv "$@" ~/.Trash ; } # trash: Moves a file to the MacOS trash
ql () { qlmanage -p "$*" >& /dev/null; } # ql: Opens any file in MacOS Quicklook Preview
alias DT='tee ~/Desktop/terminalOut.txt' # DT: Pipe content to file on MacOS Desktop
alias numFiles='echo $(ls -1 | wc -l)' # numFiles: Count of non-hidden files in current dir
alias make1mb='mkfile 1m ./1MB.dat' # make1mb: Creates a file of 1mb size (all zeros)
# memHogsTop Find memory hogs
alias memHogsTop='top -l 1 -o rsize | head -20'
# cpuHogs: Find CPU hogs
alias cpu_hogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10'
@arleym
Copy link
Author

arleym commented Jun 10, 2014

Don't forget to Symlink to dropbox if you're into that kinda thing: ln -s ~/Dropbox/dotfiles/.bashrc ~/.bashrc

@arleym
Copy link
Author

arleym commented Jun 10, 2014

.bash_profile (I have a command in .bashrc to open it) is where I keep shortcuts that shouldn't be in Dropbox as they're system specific. That file looks like:

alias sandbox='cd /Users/arleym/Documents/sandbox' source ~/.bashrc # get aliases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment