Skip to content

Instantly share code, notes, and snippets.

@eric
eric / beatport_beta_notifier.rb
Created June 15, 2011 01:01
Find out when a #newbeatport code is available
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'notifo'
class BeatportBetaNotifier
SLEEP_TIMEOUT = 10
BEATPORT_URL = 'http://beta.beatport.com/beta'
@eric
eric / wtf.rb
Created June 8, 2011 05:11 — forked from dbalatero/wtf.rb
# A little helper from _why
class Object
def metaclass
class << self; self; end
end
end
module A
def self.foo
puts "yes"
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
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
@eric
eric / DISCLAIMER.md
Created March 28, 2011 22:59
Log directly to Papertrail or any remote syslog target from Heroku
[1 : 0] eric@kiccoro:/Users/eric > wget http://bazaar.launchpad.net/~graphite-dev/graphite/main/download/head:/whisper.py-20080505183243-3ypo8j4r6x1np8hq-2/whisper.py
--2011-03-19 13:11:15-- http://bazaar.launchpad.net/~graphite-dev/graphite/main/download/head:/whisper.py-20080505183243-3ypo8j4r6x1np8hq-2/whisper.py
Resolving bazaar.launchpad.net... 91.189.90.11
Connecting to bazaar.launchpad.net|91.189.90.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21690 (21K) [text/x-python]
Saving to: `whisper.py'
100%[================================================================================================>] 21,690 90.5K/s in 0.2s
@eric
eric / README.md
Created March 18, 2011 20:20
A simple mechanism to log metrics to Redis

Redis Timeseries Metric

I've been playing around with trying to make it as simple as possible to start logging a few metrics with as little effort in setup as possible.

As I was working on Papertrail I came up with a couple interesting ideas, some of which were inspired by OpenTSDB.

Storing metrics

In this example we are pretending we're processing emails as background jobs and would like to track how many we've sent over time.

3/16/11 2:24:34 PM [0x0-0x76076].com.topfunky.PeepOpen[2111] LLVM ERROR: Cannot yet select: 0x101909010: f64 = bit_convert 0x101909410 [ORD=347] [ID=7]
3/16/11 2:24:34 PM [0x0-0x76076].com.topfunky.PeepOpen[2111] 0x101909410: i64 = and 0x101957e10, 0x101954d10 [ORD=346] [ID=6]
3/16/11 2:24:34 PM [0x0-0x76076].com.topfunky.PeepOpen[2111] 0x101957e10: i64,ch = CopyFromReg 0x10350fd88, 0x10191c110 [ORD=346] [ID=5]
3/16/11 2:24:34 PM [0x0-0x76076].com.topfunky.PeepOpen[2111] 0x10350fd88: ch = EntryToken [ORD=346] [ID=0]
3/16/11 2:24:34 PM [0x0-0x76076].com.topfunky.PeepOpen[2111] 0x10191c110: i64 = Register %reg16384 [ORD=346] [ID=1]
3/16/11 2:24:34 PM [0x0-0x76076].com.topfunky.PeepOpen[2111] 0x101954d10: i64 = Constant<-4> [ORD=346] [ID=2]
3/16/11 2:24:34 PM com.apple.launchd.peruser.501[213] ([0x0-0x76076].com.topfunky.PeepOpen[2111]) Exited with exit code: 1
3/16/11 2:25:26 PM com.apple.launchd.peruser.501[213] (com.apple.pbs) Throttling respawn: Will start in 10 seconds
3/16/11 2:25:40
@eric
eric / SAFE-RUBY.rb
Created February 16, 2011 06:24 — forked from holman/SAFE-RUBY.rb
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
@eric
eric / js_builder_template.rb
Created January 25, 2011 20:58
Playing around with a possible .jsbuilder template type for outputting json in sinatra
class JsBuilderTemplate < Template
def precompiled_preamble(locals)
[ super, "begin" ].join("\n")
end
def precompiled_postamble(locals)
"end.to_json"
end
def precompiled_template(locals)