Skip to content

Instantly share code, notes, and snippets.

@magoon
magoon / .bash_ps1
Last active December 19, 2015 18:58
Colored git prompt (current branch, status, and stash count)
################################################
# Git prompt
#
# 2013-06-25 amagoon@northps.com: added statuses
#
# save this as ~/.bash_ps1
#
# point to this file in your ~/.bash_profile
# e.g.:
#
@magoon
magoon / vagrantshalt
Last active December 19, 2015 18:58
Halt all running vagrants (or virtualboxes)
vboxmanage list runningvms | cut -d \" -f 2 | xargs -I % vboxmanage controlvm % poweroff
@magoon
magoon / gist:6002482
Created July 15, 2013 19:00
Command-like Wikipedia
# Wikipedia lookup from command line
#
# Add this function to your ~/.bash_profile
#
# Usage: wiki %s
# Example: wiki antidisestablishmentarianism
#
function wiki() { dig +short txt "$@.wp.dg.cx" ;}
@magoon
magoon / gist:6004849
Created July 16, 2013 00:43
Random password alias for your command-line
alias random='curl --silent "https://www.random.org/passwords/?num=1&len=10&format=plain&rnd=new"'
@magoon
magoon / sniff
Last active December 19, 2015 19:18
Sniff browser request headers
# Sniff browser request headers in a quick crude way
#
# deps:
# brew install ngrep
# brew install libpcap
#
sudo ngrep -q -W byline "^(GET|POST) .*"
@magoon
magoon / sniffheaders
Last active December 20, 2015 09:19
Sniff HTTP headers
sudo tcpdump -s 0 -A 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'
@magoon
magoon / gist:6258317
Created August 17, 2013 19:11
Bash alias to change dir to a subdirectory containing a known file
#
# Usage: cdf style.css
#
# Add to your ~/.bash_profile and then source ~/.bash_profile
#
# If you were in ~/somedir, this could cd ~/somedir/docroot/styles/ if it contained style.css
#
alias cdf=cdfilefunc
@magoon
magoon / .gitconfig
Last active December 22, 2015 22:29
p4merge is a free visual diff tool for Mac OS X that can be used as a git mergetool. This allows you to resolve some more complicated merge conflicts. Here is a quick getting started guide.
# Use p4merge as a mergetool for visually resolving Git merge conflicts
# by adding these lines to ~/.gitconfig
[merge]
conflictstyle = diff3
tool = p4merge
[mergetool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$LOCAL" "$PWD/$MERGED"
trustExitCode = false
[mergetool]
@magoon
magoon / widen
Last active December 24, 2015 02:59
Bookmarklet to widen Bitbucket pages
javascript:document.getElementsByClassName("aui-page-panel-inner")[0].style.width='100%';
@magoon
magoon / snippets
Created November 5, 2013 16:52 — forked from mcallari/snippets
sudo rm -rf /**