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
This time bay-beee I'll beeeeeeEEEEEEEEEeeeee - BullehhhhhhhhhhhhhhhT PROOOF. | |
This time may-beee I'll beeeeeeeeeee... Bulleeeeeht proof. |
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
require 'rubygems' | |
require 'sinatra' | |
require 'lib/sms' | |
require 'thread' | |
SECONDS_PER_MESSAGE = 1.0 | |
queue = Queue.new | |
consumer = Thread.new do |
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
require 'net/https' | |
require 'always_verify_ssl_certificates' | |
module SecurityModule | |
class HighSecurity | |
class ReallyHighSecurity | |
def self.turn_on_safe_connections | |
OpenSSL::SSL::VERIFY_NONE | |
end | |
end |
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" |
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
# 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/ |
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 | |
# 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) |
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
package main | |
import ( | |
"testing" | |
"sync" | |
"sync/atomic" | |
) | |
func TestOneBarrier(t *testing.T) { | |
expected := int32(2) |
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
require 'faraday' | |
require 'faraday_middleware' | |
require 'json' | |
class DashboardApi | |
LIBRATO_API = 'https://metrics-api.librato.com' | |
LIBRATO_API_VERSION = 'v1' | |
ENDPOINT = [LIBRATO_API, LIBRATO_API_VERSION].join('/') | |
attr_accessor :username |