Skip to content

Instantly share code, notes, and snippets.

View NZKoz's full-sized avatar

Michael Koziarski NZKoz

View GitHub Profile
@NZKoz
NZKoz / preg.rb
Created January 18, 2012 02:45 — forked from avibryant/preg.rb
require 'date'
DUE_DATE = "2012-02-15"
#data taken from http://spacefem.com/pregnant/charts/duedate2.php
#starts at day 222
DATA = [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 1, 4, 2, 2, 1, 4, 6, 7, 5, 1, 5, 8, 7, 9, 10, 11, 13, 13, 18,
14, 13, 9, 27, 29, 27, 31, 27, 26, 36, 43, 43, 51, 67, 74, 60, 47,
@NZKoz
NZKoz / gist:608901
Created October 3, 2010 20:32 — forked from nikz/gist:608899
# use me to deliver emails plz kthx
class Notifier
class Job
def self.perform(name, args)
NotifierMailer.send(name, *deserialize(args)).deliver!
end
end
# IO speed tests on a new softlayer server using the cheap 500gb Sata drives.
#62500 blocks per gig
# want to double ram
# have 12gb, so want 24gb worth
# 62500 * 24 = 1500000
root@koz-two:~# time sh -c "dd if=/dev/zero of=ddfile bs=16k count=1500000 && sync"
1500000+0 records in
1500000+0 records out
root@koz-two:~# time sh -c "dd if=/dev/zero of=ddfile bs=16k count=500000 && sync"
500000+0 records in
500000+0 records out
8192000000 bytes (8.2 GB) copied, 96.6069 s, 84.8 MB/s
real 1m44.247s
user 0m0.092s
sys 0m16.049s
root@koz-two:~# time dd if=ddfile of=/dev/null bs=16k
500000+0 records in
module Kernel
def m(object=Object.new, pattern=nil)
methods = (object.public_methods(true) - Object.new.public_methods(true)).sort
methods = methods.grep pattern unless pattern.nil?
ObjectMethods.new(methods)
end
class ObjectMethods < Array
def inspect
puts sort