Skip to content

Instantly share code, notes, and snippets.

View kastner's full-sized avatar
🕳️
actively choosing...

Erik Kastner kastner

🕳️
actively choosing...
View GitHub Profile
@kastner
kastner / graph.html
Created May 3, 2011 23:00
Draw an rrdtool style graph with canvas
<!doctype html>
<html>
<head>
</head>
<body>
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
#!/bin/bash -e
# 2010-09-19 Marc Limotte
# Run continuously (every 30 minutes) as a cron.
#
# Looks for directories in HDFS matching a certain pattern and moves them to S3, using Amazon's new
# distcp replacement, S3DistCp.
#
# It creates marker files (_directory_.done and _directory_.processing) at the S3 destination, so
@collegeman
collegeman / setup-statsd.sh
Created March 9, 2011 16:12
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
@thbar
thbar / _forward-agent-with-chef.rb
Created February 10, 2011 22:27
How to ssh forward your git deploy keys when deploying to a dedicated app user
# scenario:
# - you work from a dev account that has git authentication with keys in place
# - you use a sudoer account (first_user) to ssh and run chef on a server
# - the chef recipes deploy an application under a second_user
# - first_user and second_user don't have git keys in place and you want to use forwarding
# initial run (bootstrapping maybe)
include_recipe 'helper'
@kastner
kastner / numberish.rb
Created January 27, 2011 18:01
numberish.rb
class Numberish
def self.convert(input)
if input.to_i > 0 && input.to_i.to_s == input
return input.to_i
else
return input
end
end
end
@cowboyd
cowboyd / allruby.rb
Created January 17, 2011 19:36
Proof of concept for making all ruby available to javascript.
require 'v8'
require 'openssl'
class Module
def [](name)
self.const_get(name)
end
end
@kentbrew
kentbrew / favicon-interceptor.js
Created January 3, 2011 19:32
How to short-circuit those annoying favicon requests in node.js
// early experiments with node had mysterious double requests
// turned out these were for the stoopid favicon
// here's how to short-circuit those requests
// and stop seeing 404 errors in your client console
var http = require('http');
http.createServer(function (q, r) {
// control for favicon
<!DOCTYPE HTML>
<html>
<head>
<!-- adapted from: http://iamchenghan.wordpress.com/2010/06/01/html5-canvas-jquery-cubic-bezier-drawing-tool/ -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>HTML5 Canvas, jQuery Cubic Bezier Drawing Tool</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var canvas, context, ctrlpts = new Array();
$(function() {
#!/bin/bash
GIT_WORK_TREE=/tmp/dep
GIT_DIR=/home/ekastner/deployinator/.git
user_map_program=/tmp/usermap.sh
# if you need to test just a range of commits to debug
# for i in `git log --format=%h 83f7fec..265f9a7 | tac`