This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def collect_instance_variables object | |
values = object.instance_variables.collect do |variable| | |
object.instance_variable_get variable.to_s | |
end | |
Hash[object.instance_variables.zip(values)] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert the last 4 octets of a mac address to base 10 for a numeric value between 0-4294967295 (which is the supported range for mysql's server-id) | |
# example mac address - "00:26:9E:2B:C7:36" | |
mac_address.split(':')[2..5].join.to_i(16) | |
# => 2653669174 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
%w[logger thread json collins_client highline/import file-tail zk].each {|l| require l} | |
# simple daemon to tail the act_post giant octopus log and create znodes for blogs and posts being created | |
class ZookeeperActPost | |
attr_reader :options, :collins, :log, :zk | |
def initialize options = {} | |
@options = { | |
log: STDOUT, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
import javax.management.ObjectName | |
import javax.management.remote.JMXServiceURL | |
import javax.management.remote.JMXConnectorFactory | |
host = "zk-a835862a.tld" | |
port = 10010 | |
config = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faker' | |
File.open('lorem.txt', 'w') do |file| | |
(10 ** 6).times do |i| | |
file.puts Faker::Lorem.sentence(10 ** 4) | |
puts i | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
JSTN THEME FOR LIMECHAT 1.0 | |
put this and the other thing in ~/Library/Application Support/LimeChat/Themes/ | |
bg 1a2230 | |
hlight 273146 | |
red e44347 | |
purps 8b84d0 | |
fuscia c2339a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env tumblr_ruby | |
require 'nrpe_check/extend' | |
require 'timeout' | |
require 'json' | |
@options = { | |
timeout: 120, # seconds | |
hbck_command: 'hbase hbck 2>/dev/null', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env tumblr_ruby | |
require 'zk' | |
require 'json' | |
require 'logger' | |
require 'socket' | |
require 'timeout' | |
require 'nrpe_check' | |
class CheckHBase | |
include NRPE::Check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def instance_state_hash | |
self.instance_variables.map do |instance_variable| | |
self.instance_variable_get instance_variable.to_s.sub ':', '@' | |
end.hash | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plugins, recipes, clusters, etc | |
Dir['lib/*', 'recipes/*', 'config/groups/*'].each {|plugin| load plugin} | |
# default settings | |
load 'config/settings' |