Skip to content

Instantly share code, notes, and snippets.

View eduardo's full-sized avatar

Edu Fernández eduardo

View GitHub Profile
class GitosisCofigGenerator
def initialize
@config = {}
end
def add_group(name, options = {})
@config.store(name, {:writable => options[:writable], :readonly => options[:readonly], :members => options[:members]})
end
require 'prawn'
require 'prawn/layout'
Prawn::Document.generate("table-test2.pdf") do
headers = ["Course", "Grade", "Comments"]
data = []
10.times { |i| data << ["Home Room", "A+", "Great work!"]}
def make_table(headers, data)
table(
require 'rubygems'
require 'couchrest'
SERVER = CouchRest.new
DB = SERVER.database!('contact-manager')
class Contact < CouchRest::ExtendedDocument
use_database DB
property :first_name
@eduardo
eduardo / gist:106431
Created May 4, 2009 11:29 — forked from ezmobius/gist:105680
Deploy recipe for chef
# JSON
{
"applications": [
{
"foobar": {
"migration_command": "rake db:migrate",
"branch": "HEAD",
"deploy_action": "deploy",
"framework_env": "production",
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
# urlmonitor - print out the URLs requested system wide on the main network interface
# Accept a network interface name as an optional argument
iface = ARGV.first
# No interface specified? Try to guess which one is king..
unless iface
`ifconfig -l`.split.each do |iface|
next if iface =~ /^lo/
break if `ifconfig #{iface}` =~ /inet (0|1|2)/
@eduardo
eduardo / httpdump
Created April 4, 2009 10:55 — forked from peterc/httpdump
# Monitor HTTP requests being made from your machine with a one-liner..
# Replace "en1" below with your network interface's name (usually en0 or en1)
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile:
# (again replace "en1" with correct network interface name)
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*""
# All the above tested only on OS X.