Skip to content

Instantly share code, notes, and snippets.

View mnutt's full-sized avatar

Michael Nutt mnutt

View GitHub Profile
var util = require('util');
var Stream = require('stream');
function CachedStream() {
this.buffers = [];
this.readable = true;
this.writable = true;
}
CachedStream.prototype.write = function(buffer) {
Stream = require 'stream'
class CachedStream extends Stream
constructor: ->
@buffers = []
readable: true
writable: true
write: (buffer) ->

HUMMINGBIRD DOCS TODO

Running hummingbird locally

  • git clone hummingbird
  • install geoip
  • npm install
  • node server.js

Imagine a crossroads where four competing auto dealerships are situated. One of them (Microsoft) is much, much bigger than the others. It started out years ago selling three-speed bicycles (MS-DOS); these were not perfect, but they worked, and when they broke you could easily fix them.

There was a competing bicycle dealership next door (Apple) that one day began selling motorized vehicles--expensive but attractively styled cars with their innards hermetically sealed, so that how they worked was something of a mystery.

The big dealership responded by rushing a moped upgrade kit (the original Windows) onto the market. This was a Rube Goldberg contraption that, when bolted onto a three-speed bicycle, enabled it to keep up, just barely, with Apple-cars. The users had to wear goggles and were always picking bugs out of their teeth while Apple owners sped along in hermetically sealed comfort, sneering out the windows. But the Micro-mopeds were cheap, and easy to fix compared with the Apple-cars, and their market

@mnutt
mnutt / gist:3362233
Created August 15, 2012 18:41
Setting up rails' localhost:3000 inside a windows 7 virtualbox instance
Set up a new task on startup by following this article:
http://www.techrepublic.com/blog/window-on-windows/make-vista-launch-uac-restricted-programs-at-startup-with-task-scheduler/616
For the command, use:
netsh interface portproxy add v4tov4 listenport=3000 listenaddress=127.0.0.1 connectport=3000 connectaddress=10.0.2.2
@mnutt
mnutt / cluster.js
Created January 11, 2012 19:27
clustering with node 0.6.7
global.config = require('./lib/config').load("config/app.json");
var cluster = require('cluster');
var fs = require('fs');
var app = require('./app');
// Logging
var log = require('./lib/winston');
global.log = log;
// Write out pidfile
<html>
<body>
<h1>0</h1>
<script>
var element = document.getElementsByTagName("h1")[0];
var counter = 0;
function manualAdvance() {
counter += 1;
element.innerHTML = counter;
var http = require('http');
// Unresponsive server
http.createServer(function(req, res) {
// don't respond
}).listen(5933);
// Client that times out
@mnutt
mnutt / qimage_benchmark.cpp
Created October 30, 2011 20:40
benchmark QImage save
#include <QtGui>
#include <QTimer>
int
main(int argc, char *argv[]) {
int times = 1000;
QString format("png");
QByteArray ba;
@mnutt
mnutt / index.html
Created August 27, 2011 00:26 — forked from mbostock/.block
Mobile Patent Suits
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Mobile Patent Suits</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.29.1"></script>
<style type="text/css">