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
# | |
# by Eric Lindvall <[email protected]> | |
# | |
class LruGenerationalHash | |
attr_reader :max_size | |
def initialize(max_size, generations = 2) | |
@generations = generations.times.collect { Hash.new } | |
@max_size = max_size |
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
class KestrelQueueMonitor < Scout::Plugin | |
OPTIONS=<<-EOS | |
host: | |
label: Host | |
notes: Kestrel host | |
default: localhost | |
port: | |
label: Port | |
notes: Kestrel admin HTTP port | |
default: 2223 |
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
module ObjectDiagnostics | |
extend self | |
def display(method, options = {}) | |
res = format(method, options) | |
res.each { |l| puts l } | |
end | |
def format(method, options = {}) |
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 | |
require 'atomic' | |
atomic1 = Atomic.new([ -1, 0 ]) | |
atomic2 = Atomic.new(0) | |
array = [] | |
1000.times do |idx| |
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 'lazy' | |
require 'system_timer' | |
class ScoutMetric | |
M60_ALPHA = (1 - Math.exp(-5.minutes / 1.hour.to_f)) | |
NS_IN_SECONDS = 1000000000 | |
def initialize(metric_id, timeout = 5) | |
@metric_id = metric_id | |
@timeout = timeout |
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
class KestrelQueueMonitor < Scout::Plugin | |
OPTIONS=<<-EOS | |
host: | |
label: Host | |
notes: Kestrel host | |
default: localhost | |
port: | |
label: Port | |
notes: Kestrel admin HTTP port | |
default: 2223 |
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 'lazy' | |
require 'system_timer' | |
class LibratoMetric | |
COUNT = 10 | |
RESOLUTION = 1 | |
def initialize(metric_name, timeout = 5) | |
@metric_name = metric_name | |
@timeout = timeout |
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 'lazy' | |
require 'system_timer' | |
class LibratoMetric | |
COUNT = 10 | |
RESOLUTION = 1 | |
def initialize(metric_name, timeout = 5) | |
@metric_name = metric_name | |
@timeout = timeout |
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
# | |
# Created by Eric Lindvall <[email protected]> | |
# | |
class KestrelMonitor < Scout::Plugin | |
OPTIONS=<<-EOS | |
host: | |
label: Host | |
notes: Kestrel host | |
default: localhost | |
port: |
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 | |
# | |
# Annotate your "bundle outdated" with GitHub compare URLs | |
# | |
require 'open-uri' | |
require 'json' | |
def rubygems_gem_info(gem_name) |