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
# lib/instrumental/exception_reporter_middleware.rb | |
module Instrumental | |
class ExceptionReporterMiddleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
@app.call(env) |
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
# ruby -v => jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on OpenJDK 64-Bit Server VM 1.7.0-u10-b06-20120912 [darwin-x86_64] | |
r, w = IO.pipe | |
require 'timeout' | |
Timeout::timeout(1) { IO.select([r]) } # does not timeout, blocks indefinitely | |
# No clue how to report an issue using their JIRA reporter, so... |
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
diff --git a/cext/src/Makefile b/cext/src/Makefile | |
index 1622165..5f9ff3e 100644 | |
--- a/cext/src/Makefile | |
+++ b/cext/src/Makefile | |
@@ -154,7 +154,7 @@ endif | |
ifeq ($(OS), darwin) | |
PLATFORM = Darwin | |
- MACSDK = $(firstword $(filter-out %/MacOSX10.4u.sdk, $(wildcard /Developer/SDKs/MacOSX*.sdk))) | |
+ MACSDK = $(lastword $(filter-out %/MacOSX10.4u.sdk, $(shell find $(shell xcode-select -print-path) -name 'MacOSX10.*.sdk'))) |
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 CompactUnsignedInt | |
ASCII_RANGE = 33..126 | |
ASCII_LENGTH = ASCII_RANGE.last - ASCII_RANGE.first | |
module InstanceMethods | |
def to_compact_int | |
base = to_i | |
raise "Negative numbers will not convert" if base < 0 |
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
// In your connect middleware setup in development mode | |
app.use(require("./lib/console.log.remote/middleware")()); | |
// Your pages will have to include /console.log.js to override console.log |
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
netshade@chris-zelenak-2 [03:11:27] [~/.rvm/src/ruby-1.8.7-p352] | |
-> % ./ruby crash.rb | |
85317 | |
85318 | |
crash.rb:6: [BUG] Segmentation fault | |
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.3.0] | |
netshade@chris-zelenak-2 [03:11:34] [~/.rvm/src/ruby-1.8.7-p352] | |
-> % gdb ./ruby | |
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012) |
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 'rubygems' | |
require 'logger' | |
require 'instrumental_agent' | |
Instrumental::Agent.logger = Logger.new(STDOUT) | |
a = Instrumental::Agent.new('YOUR_API_KEY') | |
t = Time.now.to_i | |
forked = nil | |
a.increment("fork.start") |
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
while :; do (ps -o command -U YOUR_APP_USER | awk "/Rack:/ {print $1 $2}" | wc -l | { read procs; echo "hello version 1.0\nauthenticate YOUR_API_KEY\ngauge nginx.proc.num $procs `date +%s`\n" } ) | nc instrumentalapp.com 8000; sleep 60; done |
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 | |
# Provide data over STDIN to Instrumental | |
# Format of data: | |
# <metric name> <value> <unix timestamp> | |
# or | |
# <metric name> <value> | |
# | |
# Second form will assume that the time the | |
# metric is reported is when the event occurred. | |
# |
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
sudo apt-get install clang subversion autogen libtool pkg-config | |
svn co svn://mark.heily.com/libBlocksRuntime/trunk libBlocksRuntime | |
cd libBlocksRunTime | |
CC=clang ./configure | |
make | |
sudo cp libBlocksRuntime.so /usr/local/lib/ | |
sudo cp Block*.h /usr/local/include/ | |
cd .. | |
svn checkout svn://mark.heily.com/libkqueue/trunk libkqueue | |
cd libkqueue |