Skip to content

Instantly share code, notes, and snippets.

View fairchild's full-sized avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
@retr0h
retr0h / gist:9128909
Created February 21, 2014 04:44
Just about have a VIP balancer in serf
2014-02-21 04:34:34,784 INFO serf1: ['serf1', 'serf2', 'serf3'] joined
2014-02-21 04:34:34,883 INFO serf3: ['serf3', 'serf2', 'serf1'] joined
2014-02-21 04:34:34,787 INFO Added 1.1.1.1/24 to serf1 on eth1:1/24_tribe
2014-02-21 04:34:34,789 INFO Added 2.2.2.2/24 to serf1 on eth1:2/24_tribe
2014-02-21 04:34:34,790 INFO Added 3.3.3.3/24 to serf1 on eth1:3/24_tribe
2014-02-21 04:34:34,964 INFO serf2: ['serf2', 'serf1', 'serf3'] joined
root@serf1:~# service serf stop
serf stop/waiting
@fairchild
fairchild / dht_api_sample.rb
Created February 27, 2009 21:16
proposed API for ditributed has table
# sample skeleton for a ruby API based on the ideas from http://www.oceanstore.org/publications/papers/pdf/iptps03-api.pdf
class DistributeKeyBasedRouter
def initialize(deliver_to_class, deliver_class_method = :delivered)
@delivery_callback_class = deliver_to_class
@delivery_callback_method = deliver_class_method
end
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
@samgranieri
samgranieri / .gitignore
Created January 29, 2010 04:55
Rails 3 Capistrano Notes
db/*.sqlite3
log/*.log
tmp/**/*
bin/*
vendor/gems/ruby/1.8/*
!vendor/gems/ruby/1.8/cache/
@adamhunter
adamhunter / ruby-riak
Created February 19, 2010 14:34 — forked from bigfleet/ruby-riak
#!/bin/bash
# On OS X? Installed homebrew already? Interested in Riak? Get familiar!
# This command in your terminal should be a one-stop shop.
# curl http://gist.github.com/raw/308745/107168665a46decd540dd1c5d50ccdd82eb01051/ruby-riak | sh
brew install erlang wget
curl http://bitbucket.org/basho/riak/get/riak-0.8.tar.gz | tar zx
cd riak && make all rel
cd rel/riak && bin/riak start
wget http://bitbucket.org/basho/riak/raw/67c55dfd44f5/client_lib/jiak.rb
@fairchild
fairchild / github-receiver.rb
Created September 26, 2010 00:13
git push = deploy
require 'rubygems'
require 'sinatra'
require 'yajl/json_gem'
post '/' do
@push = Yajl::Parser.new(:symbolize_keys => true).parse(params[:payload])
appdir="/home/blackflag/app"
@output= Kernel.system("cd #{appdir}/shared/cached-copy && git pull origin master && cap deploy")
puts "\n output = #{@output} \n"
puts "I got some JSON: #{@push.inspect}"
@refractalize
refractalize / warden_sinatra.rb
Created February 6, 2011 10:38
Basic warden/sinatra integration
require 'rubygems'
require 'warden'
require 'sinatra'
require 'cgi'
class LoginManager < Sinatra::Base
Warden::Manager.serialize_into_session{|id| id }
Warden::Manager.serialize_from_session{|id| id }
def call(env)
@igrigorik
igrigorik / rack_routes.rb
Created March 29, 2011 04:17
Goliath + http_router.rb
require 'goliath'
require 'http_router'
# https://github.com/joshbuddy/http_router
HttpRouter::Rack.override_rack_builder!
class RackRoutes < Goliath::API
map('/get/:id') do |env|
[200, {'Content-type' => 'text/plain'}, ["My id is #{env['router.params'][:id]}\n"]]
end
@adam-e-trepanier
adam-e-trepanier / gist:1070145
Created July 7, 2011 18:14
add warden failure app
We couldn’t find that file to show.
@kazjote
kazjote / populate.rb
Created January 8, 2012 18:31
FnordMetric data generator
# Copy it to fnordmetric directory and run with
#
# bundle exec ruby -Ilib -I. populate.rb live
#
# to generate fake current traffic or
#
# bundle exec ruby -Ilib -I. populate.rb past
#
# to generate fake stats for last month.
#