Skip to content

Instantly share code, notes, and snippets.

@jbz
jbz / knife.rb
Created February 16, 2011 17:08
knife.rb that switches Opscode orgs/validators based on git branch
# This knife.rb orig. provided by jtimberman@opscode.com - but any mistakes are mine!
current_dir = File.dirname(__FILE__)
platform = "https://api.opscode.com/organizations"
require 'grit'
branch = Grit::Repo.new("#{current_dir}/..").head.name
case branch
@leegao
leegao / Full.js
Created December 10, 2010 00:52
!(???) && Profit!!!
// Compress and add javascript: prefix, then save as a bookmarklet
function process(image){
h = image.height; w = image.width;
var buffer = document.createElement("canvas"); // Anonymous canvas
buffer.width = w;buffer.height=h;
var ct = buffer.getContext('2d');
ct.drawImage(image,0,0);
var data = ct.getImageData(0,0,w,h).data; // This may raise an exception for external images.
var pxs=2; // Height-Width of the pixel block
@dje
dje / report.rb
Created October 28, 2010 05:27
a chef report to google docs
require 'rubygems'
require 'chef'
require 'fog'
require 'google_spreadsheet'
Chef::Config.from_file("~/.chef/knife.rb")
ec2 = Fog::AWS::EC2.new(:aws_access_key_id => ENV["AWS_KEY"],
:aws_secret_access_key => ENV["AWS_SECRET"] )