Skip to content

Instantly share code, notes, and snippets.

View DanBUK's full-sized avatar

Daniel Bartlett DanBUK

View GitHub Profile
@DanBUK
DanBUK / gist:1069823
Created July 7, 2011 15:52
nodester test push
[dan@m-box 834-327ffd51d202655c750101d7267a987d]$ git commit -m "Test whitespace." app.js
[master f7ed059] Test whitespace.
1 files changed, 1 insertions(+), 0 deletions(-)
[dan@m-box 834-327ffd51d202655c750101d7267a987d]$ git push
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 286 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Syncing repo with chroot
@DanBUK
DanBUK / sandbox_it.js
Created January 23, 2011 15:10
Chroot'ed node processes!
root 31098 0.0 0.5 15500 2180 pts/1 S 14:15 0:00 | \_ -bash
dan 31361 0.2 2.3 626500 8964 pts/1 Sl+ 15:08 0:00 | \_ node sandbox_it.js
[dan@arch-vm node-daemon-tools]$ curl http://127.0.0.1:8124/
Hello World
Current directory: /
err: null
files: [ 'hello.js' ]
@DanBUK
DanBUK / net.Stream.setConnTimeout.hack.js
Created January 11, 2011 22:55
This hack enables node.js to handle connection timeouts.
var net = require('net');
var sys = require('sys');
// START setConnTimeout hack
net.Stream.prototype._orig_connect = net.Stream.prototype.connect;
net.Stream.prototype.connect = function () {
var self = this;
if (typeof self.conn_timeout !== 'undefined' && self.conn_timeout > 0) {
self.addListener('connect', function () {
clearTimeout(self.conn_timer);