Skip to content

Instantly share code, notes, and snippets.

View jemmyw's full-sized avatar

Jeremy Wells jemmyw

View GitHub Profile
def get_sid_string(data)
sid = []
sid << data[0].to_s
rid = ""
(6).downto(1) do |i|
rid += byte2hex(data[i,1][0])
end
sid << rid.to_i.to_s
{
:smaccountname => ['jeremy'],
:dn => ‘["CN=Jeremy Wells,CN=Users,DC=domain,DC=boost,DC=co,DC=nz"],
:primarygroupid => ['1114'],
:objectsid => ["010500000000000525000000\210B ?\23302r\255ոT040000"]
}
{
:samaccountname=>["Students"],
:dn=>["CN=Students,OU=Groups,DC=domain,DC=boost,DC=co,DC=nz"],
:objectsid=>["010500000000000525000000\210B ?\23302r\255ոZ040000"],
:name=>["Students"]
}
class Class
def should_receive_squirrel_find_with(expected)
FindWithSquirrel.new(self, expected)
end
end
class FindWithSquirrel
include Spec::Matchers
def initialize(klass, expected)
require 'rubygems'
require 'hierclust'
require 'benchmark'
points = [[815, 183], [860, 176], [793, 176], [847, 176], [813, 176], [865, 183],
[804, 185], [813, 181], [797, 181], [193, 133], [905, 168], [821, 173],
[804, 178], [799, 180], [175, 360], [880, 176], [826, 171], [843, 181],
[857, 171], [443, 495], [857, 174], [382, 132], [97, 1203], [218, 281],
[97, 1778], [814, 181], [474, 133], [797, 179], [844, 180], [812, 178],
[846, 18], [795, 183], [862, 182], [840, 175], [788, 176], [478, 140],
#!/usr/bin/ruby
require 'rubygems'
require 'csv'
require 'rubystats'
def variance(population)
mean = 0.0
s = 0.0
#!/usr/bin/env ruby
require 'rubygems'
require 'mime/types'
require 'ruport'
require 'active_support'
MIME::Types.add(MIME::Type.new('text/x-haml'){|s|s.extensions=%w(haml)})
MIME::Types.add(MIME::Type.new('text/x-sass'){|s|s.extensions=%w(sass)})
MIME::Types.add(MIME::Type.new('application/x-ruby-rake'){|s|s.extensions=%w(rake)})
[2011-02-26 22:56:49] /Users/jeremy/.rvm/wrappers/ree-1.8.7-2010.02/rake install
/Users/jeremy/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby vm/codegen/field_extract.rb vm/builtin/object.hpp vm/builtin/integer.hpp vm/builtin/fixnum.hpp vm/builtin/array.hpp vm/builtin/bignum.hpp vm/builtin/executable.hpp vm/builtin/access_variable.hpp vm/builtin/alias.hpp vm/builtin/block_environment.hpp vm/builtin/block_as_method.hpp vm/builtin/bytearray.hpp vm/builtin/io.hpp vm/builtin/channel.hpp vm/builtin/module.hpp vm/builtin/class.hpp vm/builtin/compiledmethod.hpp vm/builtin/data.hpp vm/builtin/dir.hpp vm/builtin/exception.hpp vm/builtin/float.hpp vm/builtin/immediates.hpp vm/builtin/iseq.hpp vm/builtin/list.hpp vm/builtin/lookuptable.hpp vm/builtin/ffi_pointer.hpp vm/builtin/methodtable.hpp vm/builtin/nativefunction.hpp vm/builtin/packed_object.hpp vm/builtin/randomizer.hpp vm/builtin/regexp.hpp vm/builtin/staticscope.hpp vm/builtin/string.hpp vm/builtin/symbol.hpp vm/builtin/thread.hpp vm/builtin/tuple.hpp vm/builtin/compact
World(FactoryGirlStepHelpers)
module DataStepHelpers
def str_to_name(str)
str.to_s.strip.gsub(/\s+/m, '_').underscore
end
def get_instance(name)
instance_variable_get('@%s' % str_to_name(name).singularize)
end
@jemmyw
jemmyw / cronline.rb
Created November 11, 2011 06:42
Cronline
#
#--
# Copyright (c) 2006-2008, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: