Skip to content

Instantly share code, notes, and snippets.

@gmcquillan
gmcquillan / gist:1953453
Created March 1, 2012 21:46
crazy ruby
#!/usr/bin/env ruby
#
print "default = {:hbaseregion => {:handler_count => 25}}\n\n"
default = {:hbaseregion => {:handler_count => 25}}
print "testing defined?(default[:hbaseregion][:handler_count])\n"
if (defined?(default[:hbaseregion][:handler_count]))
print "yes\n\n"
else
print "no\n\n"
# Mixpanel, Inc.
# http://mixpanel.com
max_ring_size = 2**127
def token_percent(token, max):
return round(token / float(max_ring_size), 4)
def calc(ring_load):
highest = {'total': 0, 'percent0': 0, 'percent1': 0}