Skip to content

Instantly share code, notes, and snippets.

View lusis's full-sized avatar

John E. Vincent lusis

View GitHub Profile
#!/bin/sh
### BEGIN INIT INFO
# Provides: haproxy
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: fast and reliable load balancing reverse proxy
# Description: This file should be used to start and stop haproxy.
### END INIT INFO
[david@calavera:voldemort-0.81]$ jdev -S jirb
no such file to load -- wirble
jruby-1.5.1 > require 'lib/voldemort_client'
=> true
@mbbx6spp
mbbx6spp / .gitconfig
Created July 25, 2010 14:43
Susan Potter's .gitconfig file from November 2007 blog post. Updated since November 2007 with new aliases or options.
# Migrating my old .gitconfig blog post from 2007 to here so I can update it easier.
# Original URL:
# http://geek.susanpotter.net/2007/11/my-gitconfig.html
[user]
name = Susan Potter # make sure you change this
email = me@susanpotter.net # make sure you change this
[color]
diff = auto
status = auto
branch = auto
@someara
someara / gist:673693
Created November 12, 2010 03:40
chef hostname
bash -c '
echo <%= @config[:chef_node_name] %> > /tmp/chef_node_name
cat /tmp/chef_node_name | cut -d. -f1 > /tmp/proper_hostname
cat /tmp/chef_node_name | cut -d. -f2 | tr -d "\n" > /tmp/proper_dnsdomainname
echo -n "." >> /tmp/proper_dnsdomainname
cat /tmp/chef_node_name | cut -d. -f3 >> /tmp/proper_dnsdomainname
IPV4ADDR=`ip addr | grep eth0 | grep "inet " | cut -d " " -f 6 | cut -d \/ -f 1`
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@dje
dje / truncated_directory.rb
Created January 3, 2011 21:16
Paging through Fog 1K key limit
files = directory.files.all
truncated = files.is_truncated
while truncated
set = directory.files.all( :marker => files.last.key )
truncated = set.is_truncated
files = files + set
end
@border
border / Makefile
Created January 12, 2011 01:36
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@aviflombaum
aviflombaum / gist:777013
Created January 12, 2011 22:14
igrigorik collection of things about ruby 1.9 that make him standup
#ruby19 added ObjectSpace.count_objects method which returns a hash of types+counts of objects in current process #standup
#ruby19 allows default parameters in procs & lambdas! ex: f = -> a,b=1,*c { p [a,b,c] }; f.call(1); f.(1,2); f[1,2,3] #standup
#ruby19 no longer supports .each on a string! instead, use: .chars, .bytes, .lines #standup
#ruby19 supports 3 ways to call a proc! ex: f =->n {[:hello, n]}; f[:ruby]; f.call(:ruby); f.(:ruby) #standup
#ruby19 hashes preserve the insertion order of elements! for the curious: http://bit.ly/e0oEun #standup
@elisehuard
elisehuard / gist:819022
Created February 9, 2011 18:58
(minimal) mongrel2 handler in ruby
require 'zmq'
require 'json'
handler_ctx = ZMQ::Context.new(1)
# receive and response for mongrel2 handlers
# queue address corresponds to what's in the configuration
recv_queue = handler_ctx.socket(ZMQ::PULL)
recv_queue.connect("tcp://127.0.0.1:9999")
bash -c '
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum install -q -y sudo gcc gcc-c++ automake autoconf make readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64 wget
# This may not be necessary for you
yum remove -q -y ruby-libs ec2-ami-tools
wget http://someurl.domain.com/ruby-1.9.2p180_x86_64.rpm -O /tmp/ruby-1.9.2p180_x86_64.rpm
yum localinstall --nogpgcheck -q -y /tmp/ruby-1.9.2p180_x86_64.rpm