Skip to content

Instantly share code, notes, and snippets.

View jnewland's full-sized avatar

Jesse Newland jnewland

View GitHub Profile
@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.

@seancribbs
seancribbs / Vagrantfile.rb
Created February 4, 2011 18:45
Snippets for blog post about building a local Riak cluster with chef, Opscode Platform, and vagrant.
Vagrant::Config.run do |config|
# Use the Opscode box that we downloaded.
config.vm.box = "chef-ubuntu"
# Let's give the box an IP that is accessible by the other nodes we
# will spin up.
config.vm.network "33.33.33.11"
# Forward the Riak HTTP and Protobufs ports so we can access them
# locally.
Vagrant::Config.run do |global_config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.76.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027076")
fixed = (ENV['FIXED'] or "10.0.76.0/24")
global_config.vm.define :chef do |config|
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
15:15 <jiboumans> i just noticed somethign really strange: i do a get on a key, get a 404.
this key was previously returned from a listkeys operation, so i know it's htere. I do the get *again* and it
returns the object: http://pastebin.com/3T561WAF. what bizarre issue am i running into?
15:16 <jiboumans> the only thing I can think is special about this setup is that this node is normally
in a cluster of 4, but the other 3 instances do not have riak running at the moment
15:16 <seancribbs> jiboumans: read-repair
15:16 <jiboumans> seancribbs: i dont know what that means. is this some riak-admin command?
@jordansissel
jordansissel / Better Usage.md
Created December 20, 2010 12:07
Strip package scripts from .deb packages (postinst, postrm, preinst, prerm)

The best way to use this tool is to hook apt's use of dpkg to run it before doing any package installs.

In your apt.conf, put this:

DPkg::Pre-Install-Pkgs {"xargs -rL1 bash /path/to/stripdeb.sh 2>&1 | logger -t stripdeb"}

Then, a demo:

% sudo apt-get install mysql-server-5.1

@fujin
fujin / chef.rb
Created October 30, 2010 02:09
this one gets monkeypatched into a library. I called mine cookbooks/libsonian/libraries/signed_url.rb & chef.rb
class Chef
class Provider
class RemoteS3File < Chef::Provider::RemoteFile
def load_current_resource
super
%w{bucket object_name aws_access_key_id aws_secret_access_key}.map do |attribute|
Chef::Application.fatal! "remote_s3_file: required attr: #{attribute} is nil", -92 if
@new_resource.send(attribute.to_sym).nil?
end
commit f21a996ff88a09d30e818fc9815f19c055efb215
Author: Erik Kastner <[email protected]>
Date: Wed Oct 6 22:39:46 2010 -0400
work in progress
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index 4ad80f7..76a3c35 100644
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
kastner:rrdtool-1.4.4/ (master✗) $ ./src/rrdtool json --step 10 --start 1286401820 --end 1286402120 DEF:bob=bob.rrd:bob:AVERAGE CDEF:realbob=bob,1000,\* XPORT:bob:"bobs" XPORT:realbob:"Real bobs"
[
{
"bobs": {
"start": 1286401830,
"step": 10,
"end": 1286402130,
"data_points": [
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 278.14286, 209.50000, null, 102.50000, 8.40000, null, null, null, null, null
]
@foca
foca / isolated_rails.rb
Created September 24, 2010 14:11
Rails template using Isolate for dependency management. Most of the code was blatantly stolen from jbarnette
run "rm public/index.html"
file "Isolate", <<-END
gem "rails", "3.0.1"
gem "haml", "3.0.22"
gem "sqlite3-ruby", "1.3.1"
env :development do
gem "haml-rails", "0.2"
end
15:51 <fujin> yo guys
15:52 <fujin> is there a way to automatically cluster Riak via similar method to rabbitmq_cluster.config?
A list of node@sname terms, if I'm not mistaken.
15:52 <fujin> I'm levelling up benblack's shit.
15:54 <fujin> oh
15:54 <fujin> disregard