View broadcast_trigger.rb
1 2 3 4 5 6 7 8 9 10
module Zookeeper
class BroadcastTrigger
def initialize(zk, path)
@zk = zk
@path = path
end
 
def trigger
@zk.set(@path, "#{$$}")
rescue ZK::Exceptions::NoNode
View remote_syslog.god
1 2 3 4 5 6 7 8 9
God.watch do |w|
w.name = 'remote_syslog'
 
w.interval = 7.seconds
 
w.log = File.join(RAILS_ROOT, 'log', "#{w.name}-god.log")
 
w.dir = RAILS_ROOT
w.start = "bundle exec remote_syslog --tls -D -c #{RAILS_ROOT}/config/remote_syslog.yml"
View redis_failover.rake
1 2 3 4 5 6 7 8 9 10
namespace :redis_failover do
task :monitor_client do
require 'redis_failover'
 
zookeepers = ENV['ZOOKEEPERS']
 
if !zookeepers && zookeepers_file = ENV['ZOOKEEPERS_FILE']
if File.exists?(zookeepers_file)
zookeepers = File.read(zookeepers_file).chomp
end
View librato_metric.rb
1 2 3 4 5 6 7 8 9 10
require 'lazy'
require 'system_timer'
 
class LibratoMetric
COUNT = 10
RESOLUTION = 1
 
def initialize(metric_name, timeout = 4)
@metric_name = metric_name
@timeout = timeout
View jobs.rb
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
# encoding: utf-8
 
# setup
#
require 'fileutils'
 
script = File.expand_path(__FILE__).gsub(%r|\breleases/\d+\b|, 'current')
script_dir = File.dirname(script)
rails_root = File.dirname(script_dir)
View boundary_client.rb
1 2 3 4 5 6 7 8 9
#
# Simple Boundary client
#
 
class BoundaryClient
def initialize(orgid, apikey)
@orgid = orgid
@apikey = apikey
end
View cubism.papertrail.js
1 2 3 4 5 6 7 8 9 10
/*
* Cubism source for Papertrail
* https://papertrailapp.com/
*/
 
cubism.context.prototype.papertrail = function(token) {
var source = {};
 
source.metric = function(expression, title) {
var lookup = {};
View _deploy.rb
1 2 3 4 5
# load plugin
load 'boundary'
 
# Notify boundary with your orgid, apikey
boundary.register 'cdd7261592bca18539eae9bb5f1bcfdd', 'f9e6282c4727c5733585a4be86e0f990'
View crash_a_187.rb
1 2 3 4 5
require 'thread'
 
# This seems to crash 1.8.7
10.times { Thread.new { Queue.new.pop } }
Process.waitpid fork { GC.start; puts "In child: #{$$}" }
View convenience.rb
1 2 3 4 5 6 7 8 9 10
module Papertrail
module Zookeeper
module Convenience
def assign(key, value, options = {})
set(key, value, options)
rescue ZK::Exceptions::NoNode
begin
create(key, value, options)
rescue ZK::Exceptions::NodeExists
set(key, value, options)
Something went wrong with that request. Please try again.