Skip to content

Instantly share code, notes, and snippets.

@zenhob
zenhob / gist:f70bbb802e3e6729a1a6
Created May 31, 2014 22:52
Bulding Go binaries for Raspberry Pi

To build a binary that will run on the Raspberry Pi, you need to have a Go cross compiler and enable it when building the executable.

To build the cross compiler for Linux/ARM (you only need to do this once):

cd /usr/local/go/src
sudo GOOS=linux GOARCH=arm ./make.bash --no-clean

Once you've done that, you can build a binary for Raspberry Pi:

@zenhob
zenhob / generic_api.rb
Created April 4, 2014 03:57
Starter Ruby client for your REST API, based on Faraday
#
# This module is a starter Ruby client for your REST API, based on Faraday:
# https://github.com/lostisland/faraday/
#
# It supports HTTP basic authentication, sending and recieving JSON, and simple error reporting.
# I use this as a basis for building API clients in most of my Ruby projects.
#
# Use it like this:
#
# http = GenericApi.connect('http://localhost:3000/', 'myname', 'secret')

I am excited for the potential opportunity to help Heroku improve their distributed data collection and plan for future growth in the same way that I've done for numerous companies over the course of my career.

Most recently, as a member of the Insights team, I helped build numerous features of our cutting-edge analytics platform, on both the back- and front-end. We developed new tools that allowed customers to query custom event data in real time, and visualize those query results in a number of useful ways. During this time we operated as a full devops team: we handled our own

@zenhob
zenhob / -
Created February 4, 2014 22:47
#!/bin/sh
#
# Patches and installs Ruby to expose OpenSSL context options, using rbenv.
#
# Based on http://philippe.bourgau.net/how-to-install-a-patched-ruby-interpreter-wit/
#
VERSION=2.0.0-p247
PATCH_URL="https://bugs.ruby-lang.org/attachments/download/4210/0001-Expose-the-SSLContext-options-attribute-in-Net-HTTP.patch"
PATCH_NAME=ssloptions
@zenhob
zenhob / gist:5146625
Created March 12, 2013 20:18
JQuery-alike JSON client API. Includes promises and cross-browser compatibility.
define('json-client', function() {
var JSON_KEY;
var API_BASE = '';
var validResponses = {
200: true,
201: true,
204: true

AccessibleFor: key-based hash sanitizer for Ruby

This is a simple mass-assignment security module loosely based on [ActiveModel::MassAssignmentSecurity][1]. It attempts to steal the good ideas and some of the API while being compatible with Rails 2.3-based applications.

Only attr_accessible (or its equivalent, keep reading) is implemented, because attr_protected is just a bad ActiveRecord API that hung around for some reason, and we don't want it stinking up the place.

@zenhob
zenhob / days_since.coffee
Created January 19, 2012 00:02 — forked from ajacksified/days_since.coffee
hubot script for tracking days since an event
# Generates commands to track days since an event
#
# it's been <number> days since <event> - Set the day when the event happened
# <event> on <date> - Set the date the event happened (yyyy-mm-dd)
# how long since <event>? - Display the number of days since the event
module.exports = (robot) ->
robot.respond /(.*?) on ((19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]))/, (msg) ->
event = msg.match[1]
date = new Date(msg.match[2])
@zenhob
zenhob / days_since.coffee
Created January 18, 2012 23:07
hubot script for tracking days since an event
# Generates commands to track days since an event
#
# it's been <number> days since <event> - Set the day when the event happened
# how long since <event>? - Display the number of days since the event
module.exports = (robot) ->
robot.respond /it's been (\d+) days since\s+(.*?)[.?!]?$/i, (msg) ->
date = new Date
date.setTime(date.getTime() - (parseInt(msg.match[1])*1000*24*60*60))
robot.brain.data.days_since ||= {}
#!/usr/bin/env ruby -rubygems
require 'faraday'
require 'trollop'
require 'fileutils'
class ZenDesk2Tender
include FileUtils
attr_reader :opts, :conn
EXPORT_DIR = '.export-data'
var fs = require("fs"),
sys = require("sys"),
path = require("path");
exports.MIME_TYPES = {
".txt" : "text/plain",
".html" : "text/html",
".css" : "text/css",
".js" : "application/x-javascript",
".manifest" : "text/cache-manifest"