Skip to content

Instantly share code, notes, and snippets.

View brettg's full-sized avatar

Brett Gibson brettg

View GitHub Profile

Keybase proof

I hereby claim:

  • I am brettg on github.
  • I am brettg (https://keybase.io/brettg) on keybase.
  • I have a public key ASAZfemOtx-X58_Lx_r_Ds3g-lTdZ1cfmBt-XV5X4IjA1Ao

To claim this, I am signing this object:

## ## ######## ## ######
## ## ## ## ## ## ##
## ## ## ## ## ##
## ## ######## ## ######
## ## ## ## ## ##
## ## ## ## ## ## ##
####### ## ## ######## ######
######## ## ## ######## ### ## ## ########
## ## ## ## ## ## ## ### ## ## ##
SetEnv PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin
GEMPATHS=`gem environment | awk '/GEM PATHS/, /GEM [^P]/ {print $2}' | grep -v GEM`
function gemdir {
echo $GEMPATHS | xargs -n 1 -I %s find %s/gems -type d -depth 1 | grep $1 | sort | tail -1
}
# really awesome function, use: cdgem <gem name>, cd's into your gems
# directory and opens gem that best matches the gem name provided
function cdgem {
GEMDIR=`gemdir $1`
if [ $GEMDIR ] && [ -d $GEMDIR ]; then
cd $GEMDIR
#!/usr/bin/env ruby
# Posterous.com API HTTP AUTH Example
require 'base64'
require 'open-uri'
require 'net/http'
user = 'email@example.com'
password = 'password'
host = 'posterous.com'
> sudo munin-node-configure --shell
ln -s /usr/share/munin/plugins/mysql_bytes /etc/munin/plugins/mysql_bytes
ln -s /usr/share/munin/plugins/mysql_queries /etc/munin/plugins/mysql_queries
ln -s /usr/share/munin/plugins/mysql_slowqueries /etc/munin/plugins/mysql_slowqueries
ln -s /usr/share/munin/plugins/mysql_threads /etc/munin/plugins/mysql_threads
#!/usr/bin/env ruby
require 'open-uri'
url = 'http://ycombinator.com/faq.html'
body = open(url){|f| f.read}
link_text = body.match(/The ones that are currently launched are:.*?<p>/m).to_s
domains = link_text.gsub(/<!--.*?-->/m, '').scan(%r{<a href="http://([^"]+)"})
orgs = {}
domains.each do |c|