This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user gaffneyc gaffneyc; | |
daemon off; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
passenger_root /Users/gaffneyc/.rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2; | |
passenger_ruby /Users/gaffneyc/.rvm/wrappers/ruby-1.8.7-p330/ruby; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with | |
# watchr .watchr | |
watch('^roles/.*\.rb') { |m| role(m[0]) } | |
watch('^cookbooks/(.+?)/.*') { |m| cookbook(m[1]) } | |
watch('^d.*bags/(.+?)/.*') { |m| dbags(m[1], m[0]) } | |
def role(file) | |
system "knife role from file #{file}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: yumrepo | |
# Definition:: yumrepo | |
# | |
# Copyright 2010, Tippr Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'benchmark' | |
require 'mongo_mapper' | |
require 'mongoid' | |
# With GC enabled | |
# Rehearsal ----------------------------------------------------------- | |
# mongomapper creates 0.350000 0.010000 0.360000 ( 0.374451) | |
# Mongoid creates 0.210000 0.000000 0.210000 ( 0.224762) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserCodeSchedule < ActiveRecord::Base | |
def send_starting_schedule | |
send_command('set_schedule', options('start')) | |
end | |
def send_ending_schedule | |
send_command('set_schedule', options('end')) | |
end | |
def options(option_type) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Would love to do this with chef | |
directory("/home/gaffneyc") do | |
uid "gaffneyc" | |
gid "gaffneyc" | |
mode "0700" | |
directory(".ssh") do | |
# implies uid, gid, and mode | |
template("authorized_keys") do | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "ffi-rzmq" | |
Thread.abort_on_exception = true | |
COUNT = 100 | |
WORKER_COUNT = 2 | |
context = ZMQ::Context.create | |
producer = Thread.new do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "ipaddr" | |
require "net/http" | |
# Q: What is a bogon? | |
# A: See http://www.team-cymru.org/Services/Bogons/ | |
class BogonList | |
LIST_URL = "http://www.team-cymru.org/Services/Bogons/fullbogons-ipv4.txt" | |
def self.addresses | |
@addresses ||= self.load |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NodeUpdateFromFile < ::Chef::Knife | |
deps do | |
require "chef/node" | |
require "chef/json_compat" | |
require "chef/knife/core/object_loader" | |
end | |
banner "knife node update from file FILE (options)" | |
def loader |