Skip to content

Instantly share code, notes, and snippets.

View simonrussell's full-sized avatar

Simon Russell simonrussell

View GitHub Profile
def object_report(type = nil)
if type
puts "number of (#{type}) objects in memory = #{ObjectSpace.each_object(type).count}"
else
puts "number of objects in memory = #{ObjectSpace.each_object.count}"
end
end
def full_report
ObjectSpace.each_object.to_a.inject(Hash.new(0)) do |h,o|
@simonrussell
simonrussell / gist:3014871
Created June 29, 2012 00:14
Setting ownership and permissions on a named pipe with Chef
file "/path/to/pipe" do
owner "bob"
group "employees"
mode 0755
only_if { FileTest.pipe?("/path/to/pipe") }
end
@simonrussell
simonrussell / gist:1182452
Created August 31, 2011 00:01
CPU info on linux from a four core hyperthreaded CPU.
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
stepping : 7
cpu MHz : 1600.000
cache size : 8192 KB
physical id : 0
siblings : 8