Skip to content

Instantly share code, notes, and snippets.

View shimondoodkin's full-sized avatar

Shimon Doodkin shimondoodkin

View GitHub Profile
@tsmith
tsmith / gist:758517
Created December 29, 2010 13:04
three minute cloud server illustration with node-control
/*global require */
// Illustration-only for a mailing list discussion - not a recommended pattern
// for production because of root usage. Untested.
// http://groups.google.com/group/nodejs/browse_thread/thread/b41ad5d727d8dff8
// usage example:
// node thisfile.js local server:create
// node thisfile.js local server:stop <IP>
// node thisfile.js local server:start <IP>
var types = {
'.3gp' : 'video/3gpp',
'.a' : 'application/octet-stream',
'.ai' : 'application/postscript',
'.aif' : 'audio/x-aiff',
'.aiff' : 'audio/x-aiff',
'.asc' : 'application/pgp-signature',
'.asf' : 'video/x-ms-asf',
'.asm' : 'text/x-asm',
'.asx' : 'video/x-ms-asf',
// Copyright 2009 Ryan Dahl <[email protected]>
#include <v8.h>
#include <node.h>
#include <node_os.h>
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
// Copyright 2009 Ryan Dahl <[email protected]>
#ifndef SRC_OS_H_
#define SRC_OS_H_
#include <node.h>
#include <v8.h>
#include <sys/types.h>
#include <pwd.h> /* getpwuid() */
#include <grp.h> /* getgrgid() */