Skip to content

Instantly share code, notes, and snippets.

View lak's full-sized avatar

Luke Kanies lak

View GitHub Profile
#!/usr/bin/ruby
class ConstantTest
class FooTest
def self.yep
puts "yep"
end
end
self.const_get("FooTest").yep
end
class BaseTesting
STORE = :data_mapper
def initialize
Puppet::Node.terminus_class = STORE
Puppet::Node::Facts.terminus_class = STORE
end
def node_test
node = Puppet::Node.new("foo.madstop.com")
node.environment = "production"
class ChecksumTesting
require 'digest/md5'
require 'benchmark'
def benchmark(label)
seconds = Benchmark.realtime { yield }
puts "%s in %0.2f seconds" % [label, seconds]
end
def initialize(file)
require 'json'
class JsonTester
def self.from_json(text)
data = JSON.parse(text)
p data
if data.include?("data")
data = data["data"]
end
class RailsBenchmarking
BRANCHES = %w{rails/new rails/normal rails/new_no_accum}
attr_accessor :type, :host
def clear
system("rm -rf #{path}")
end
def initialize
class SortedWalking
class Vertex
attr_accessor :weight, :label
def initialize(label, weight = nil)
@label = label
@weight = weight || 5
end
def to_s
class BaseTesting
STORE = :data_mapper
def initialize
Puppet::Node.terminus_class = STORE
Puppet::Node::Facts.terminus_class = STORE
end
def node_test
node = Puppet::Node.new("foo.madstop.com")
node.environment = "production"
#!/usr/bin/ruby
class Metric
def +(value)
self.class.new(@value + value.to_i)
end
def initialize(value = 0)
@value = value
end
Exec { path => "/usr/bin:/usr/sbin:/bin" }
class cc { notify { 'cc': } }
define util() {
exec { "util_$name": command => 'echo hoho', require => Class[cc] }
}
define job() {
include cc
Puppet::Parser::Functions.newfunction :load_data, :type => :statement do |args|
if args.length == 1
klass = args[0]
else
klass = resource.title
end
datadir = "/Users/luke/git/clients/redhat/data"
dirs = datadir.split("/") + klass.split("::")