Skip to content

Instantly share code, notes, and snippets.

View jnewland's full-sized avatar

Jesse Newland jnewland

View GitHub Profile
-module(test_helper).
-export([riak_test/1]).
riak_test(Fun) ->
start_riak(),
{ok, Riak} = riak:local_client(),
Ret = (catch Fun(Riak)),
stop_riak(),
case Ret of
@technoweenie
technoweenie / github_oauth_busy_developer_guide.md
Created May 30, 2010 18:34
GitHub OAuth Busy Developer's Guide

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
# A mechanism for shadow_puppet to install source packages
module Moonshine
module SourcePackage
def source_package(name, options = {})
build_root = options[:build_root] || '/usr/src'
dist_root = options[:dist_root] || File.join(build_root, 'dist')
url = options[:url]
filename = options[:filename] || File.basename(url)
expanded_directory = options[:expanded_directory] || filename[/^(.+)\.(tar|tgz|tbz)/, 1]
expanded_root = options[:expanded_root] || File.join(build_root, expanded_directory)
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
@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
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
]
commit f21a996ff88a09d30e818fc9815f19c055efb215
Author: Erik Kastner <kastner@gmail.com>
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
@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
@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

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?