gem 'remote_syslog_logger'
This file contains 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 NetworkLatency < Scout::Plugin | |
OPTIONS=<<-EOS | |
host: | |
label: Host | |
notes: The remote host to measure. Defaults to the default gateway if none is specified. | |
count: | |
label: Count | |
notes: Number of samples to take | |
default: 5 | |
EOS |
This file contains 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
From 53402e071c7f9d4646bd98c5e5d5e97e69073f3a Mon Sep 17 00:00:00 2001 | |
From: Eric Lindvall <[email protected]> | |
Date: Fri, 27 May 2011 12:46:00 -0700 | |
Subject: [PATCH] Only deallocate the frame if it isn't NULL. | |
--- | |
app_swift.c | 40 +++++++++++++++++++++------------------- | |
1 files changed, 21 insertions(+), 19 deletions(-) | |
diff --git a/app_swift.c b/app_swift.c |
This file contains 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
# A little helper from _why | |
class Object | |
def metaclass | |
class << self; self; end | |
end | |
end | |
module A | |
def self.foo | |
puts "yes" |
This file contains 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 'nokogiri' | |
require 'open-uri' | |
require 'notifo' | |
class BeatportBetaNotifier | |
SLEEP_TIMEOUT = 10 | |
BEATPORT_URL = 'http://beta.beatport.com/beta' | |
This file contains 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
diff --git a/lib/rollout.rb b/lib/rollout.rb | |
index 4727b97..fe469f8 100644 | |
--- a/lib/rollout.rb | |
+++ b/lib/rollout.rb | |
@@ -1,7 +1,10 @@ | |
class Rollout | |
- def initialize(redis) | |
- @redis = redis | |
- @groups = {"all" => lambda { |user| true }} | |
+ attr_accessor :population |
This file contains 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
[1 : 0] eric@morizo:/Users/eric > irb | |
>> regex = /\A(?:%[0-9a-fA-F]{2}|[^%]+)*\z/ | |
=> /\A(?:%[0-9a-fA-F]{2}|[^%]+)*\z/ | |
>> str = "http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26source%3Dweb%26cd%3D1%26sqi%3D2%26ved%3D0CCkQFjAA%26url%3Dhttp%253A%252F%252Fnd.edu%252F%26rct%3Dj%" | |
=> "http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26source%3Dweb%26cd%3D1%26sqi%3D2%26ved%3D0CCkQFjAA%26url%3Dhttp%253A%252F%252Fnd.edu%252F%26rct%3Dj%" | |
>> regex =~ str |
Posted to the REE Google Group as well: https://groups.google.com/forum/#!topic/emm-ruby/EBkMfFpk40A
A week back I innocently updated Sinatra on an app which in turn updated Rack. Since then, I've had crazy hung passenger processes that just gobble up CPU like it is going out of style.
After spending a few days trying everything I knew to to fix it, today I got help from a friend (Eric Lindvall) and dug in with strace, rbtrace, gdb, and gdb.rb and found the issue. Rack 1.3.0 tests a regex against a URL and it causes things to hang.
This file contains 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 YourThing | |
def self.connection | |
@connection ||= Faraday::Connection.new do |b| | |
b.use Faraday::Request::UrlEncoded | |
# and all the rest | |
end | |
end | |
def connection | |
@connection ||= begin |
This file contains 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
# If your workers are inactive for a long period of time, they'll lose | |
# their MySQL connection. | |
# | |
# This hack ensures we re-connect whenever a connection is | |
# lost. Because, really. why not? | |
# | |
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
# | |
# From: | |
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |