Skip to content

Instantly share code, notes, and snippets.

Grant Rodgers grantr

Block or report user

Report or block grantr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
grantr / client.irb
Created Jan 11, 2013
zensu dynamic configuration and remote broadcast
View client.irb
>> require 'zensu'
=> true
>>!; nil
=> nil
>> Zensu.config.servers = ["tcp://"]
=> ["tcp://"]
>> D, [2013-01-11T14:08:30.692941 #7480] DEBUG -- default: got connect_delayed socket event: event [2], addr [tcp://], fd [115], field2 [115]
D, [2013-01-11T14:08:30.694223 #7480] DEBUG -- default: got connected socket event: event [1], addr [tcp://], fd [19], field2 [19]
I, [2013-01-11T14:08:32.152452 #7480] INFO -- default: 76711953-fa99-4586-8520-000000050000 up
D, [2013-01-11T14:09:37.599686 #7480] DEBUG -- default: handled broadcast: zensu.broadcast.topic hello clients
View socket_monitor.rb
>> require 'celluloid/zmq'
=> true
>> socket =
=> #<Celluloid::ZMQ::DealerSocket:0x00000001d7d470>
>> m =, "socket.monitor")
=> #<Celluloid::ZMQ::SocketMonitor:0x00000001bbf9d0 @socket=#<Celluloid::ZMQ::DealerSocket:0x00000001d7d470>, @topic="socket.monitor", @flags=1023, @listener=#<Celluloid::ZMQ::PairSocket:0x00000001bbf980>>
>> m.terminate
NoMethodError: undefined method `terminate' for #<Celluloid::ZMQ::SocketMonitor:0x00000001bbf9d0>
from (irb):4
from /home/grantr/.rbenv/versions/1.9.3-p362/bin/irb:12:in `<main>'
grantr / monitor.rb
Last active Dec 10, 2015
ffi-rzmq socket monitor test
View monitor.rb
require 'ffi-rzmq'
class Event
class Layout < FFI::Struct
layout :event, :int,
:data, ZMQ::LibZMQ::EventData
def initialize(msg)
@data =
grantr / ring_manager.rb
Created Dec 14, 2012
Celluloid ring pool example
View ring_manager.rb
require 'celluloid'
module Celluloid
class RingManager
include Celluloid
trap_exit :crash_handler
def initialize(worker_class, options = {})
@size = options[:size] || [Celluloid.cores, 2].max
raise ArgumentError, "minimum ring size is 2" if @size < 2
grantr / benchmark.out
Created Nov 21, 2012
Celluloid::IncidentLogger benchmarks
View benchmark.out
MRI 1.9.3-p125
==== Ruby standard logger ====
Calculating -------------------------------------
standard 3361 i/100ms
standard 35759.4 (±5.5%) i/s - 181494 in 5.090712s
==== below level ====
Calculating -------------------------------------
below level 47480 i/100ms
grantr / gist:4074383
Created Nov 14, 2012
rabbitmqctl environment
View gist:4074383
Application environment of node sensu1@sensu1 ...
View waiting.wsp.dump
Meta data:
aggregation method: average
max retention: 63072000
xFilesFactor: 0.5
Archive 0 info:
offset: 52
seconds per point: 10
points: 2160
retention: 21600
grantr / reel_chunked_test.rb
Created Aug 29, 2012
Reel chunked-encoding bug
View reel_chunked_test.rb
require 'reel'
connections = []
server = Reel::Server.supervise '', 3012 do |connection|
if request = connection.request
connections << connection
connection.respond :ok, transfer_encoding: :chunked
grantr / reel_app.rb
Created Aug 23, 2012
Reel-powered http endpoints
View reel_app.rb
require 'octarine'
require 'reel'
module Reel
module App
def self.included(base)
base.class_eval do
include Octarine::App
attr_accessor :server
grantr / gist:3166617
Created Jul 23, 2012
ffi-rzmq segfault
View gist:3166617
/us/apps/rails_app/shared/bundle/ruby/1.9.1/gems/ffi-rzmq-0.9.3/lib/ffi-rzmq/socket.rb:189: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0075 p:---- s:0265 b:0265 l:000264 d:000264 CFUNC :zmq_connect
c:0074 p:0022 s:0260 b:0260 l:000259 d:000259 METHOD /us/apps/rails_app/shared/bundle/ruby/1.9.1/gems/ffi-rzmq-0.9.3/lib/ffi-rzmq/socket.rb:189
c:0073 p:0015 s:0255 b:0254 l:000245 d:000253 BLOCK /us/apps/rails_app/shared/bundle/ruby/1.9.1/gems/tracer5-0.1.2/lib/tracer5/subscriber/zmq_output.rb:16
c:0072 p:---- s:0251 b:0251 l:000250 d:000250 FINISH
c:0071 p:---- s:0249 b:0249 l:000248 d:000248 CFUNC :each
c:0070 p:0149 s:0246 b:0246 l:000245 d:000245 METHOD /us/apps/rails_app/shared/bundle/ruby/1.9.1/gems/tracer5-0.1.2/lib/tracer5/subscriber/zmq_output.rb:15
You can’t perform that action at this time.