Skip to content

Instantly share code, notes, and snippets.

View davidlee's full-sized avatar

David Lee davidlee

View GitHub Profile
#!/usr/bin/env zsh
#
# ZWS 1.2 (2006-03-22)
#
# Copyright © 2004-2006, Adam Chodorowski. All rights reserved.
# This file is part of the ZWS program, which is distributed under
# the terms of version 2 of the GNU General Public License.
# ===========================================================================
# Initialization.
#
# Cookbook Name:: munin
# Recipe:: default
#
# Copyright 2008, OpsCode, 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
#
munin_nodes = Chef::Node.list.map do |name|
Chef::Node.load(name)
end.select do |node|
node.recipe_list.include?( "munin-node" )
end
munin_node_list = {}
munin_nodes.each do |node|
munin_node_list[node.attribute[:fqdn]] = node.attribute[:ipaddress]
#!/usr/bin/ruby
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
Chef::Config.from_file("/etc/chef/server.rb")
require 'rubygems'
require 'active_support'
require 'active_record'
# punch the duck
# Module initialisation and plug-in code inspired by will_paginate...
module MoneyHandler
module Validations
module ClassMethods
require 'rubygems'
require 'activerecord'
module Foo
def foo
puts "foo"
end
end
ActiveRecord::Validations::ClassMethods.send(:include, Foo)
#!/usr/bin/env ruby
# bin/console.rb
# a nice little ruby console for your Sinatra app
ENV["RACK_ENV"] ||= ( ARGV[0] || 'development' )
this_file = File.expand_path( __FILE__ )
app_file = File.expand_path( File.join( File.dirname( __FILE__), '../app' ))
cmd = "irb -r #{ this_file } -r irb/completion --simple-prompt"
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
@config = {
:host => "127.0.0.1",
:port => 9666
}
EventMachine::run do
# Policy Socket Server
EventMachine::start_server( Socky::HOST,
Socky::Policy::PORT,
Socky::Policy::Server )
# XML Socket Server
EventMachine::start_server( Socky::HOST,
Socky::XmlSocket::PORT,
require 'rubygems'
require 'eventmachine'
module Socky
module Policy
DEBUG = true
HOST = 'localhost'
PORT = 843
EOF = "\r\000"
REQUEST = "<policy-file-request/>\000"