Skip to content

Instantly share code, notes, and snippets.

View drudge's full-sized avatar

Nicholas Penree drudge

View GitHub Profile
#!/usr/local/bin/node
var spawn = require('child_process').spawn
, exists = require('path').exists
, pump = require('util').pump
, coffeePath = '/usr/local/bin/coffee';
exists(coffeePath, function(ex) {
process.stdin.resume();
@drudge
drudge / init.pp
Created June 25, 2012 17:17
Node.js Puppet Module
class nodejs ( $version, $logoutput = 'on_failure' ) {
$nave_path = '/usr/local/bin/nave'
$nave_dir = '/usr/local/lib/nave'
package { 'bash':
ensure => present,
}
package { 'curl':
ensure => present,
@drudge
drudge / init.pp
Created June 25, 2012 17:59
nginx Puppet Module
class nginx ( $release = 'stable' ) {
$apt-base = '/etc/sources.list.d/nginx'
if !defined(Package["python-software-properties"]) {
package { "python-software-properties":
ensure => installed,
}
}
exec { 'add nginx repository' :
server {
server_name something.domain.com;
root /home/sites/something.domain.com/static;
client_max_body_size 2G;
location / {
try_files $uri @some_site;
}
@drudge
drudge / node-completions.js
Created July 13, 2012 19:09
Generate Node.js completions for Chocolat from the Node API Docs
var http = require('http')
, fs = require('fs')
, out = {};
[ 'process', 'stdio', 'util', 'fs', 'domain', 'net', 'http', 'https', 'tls', 'events', 'crypto', 'path', 'url', 'vm', 'querystring', 'os', 'tty',
'punycode', 'zlib', 'dns', 'dgram'].forEach(function(moduleName) {
var opts = {
host: 'nodejs.org'
, port: 80
, path: '/api/' + moduleName + '.json'
function isPrivateIP(ip) {
return ip.match(/^10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/) != null ||
ip.match(/^192\.168\.([0-9]{1,3})\.([0-9]{1,3})/) != null ||
ip.match(/^172\.16\.([0-9]{1,3})\.([0-9]{1,3})/) != null ||
ip.match(/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/) != null ||
ip.match(/^169\.254\.([0-9]{1,3})\.([0-9]{1,3})/) != null ||
ip.match(/^fc00:/) != null || ip.match(/^fe80:/) != null;
}
@drudge
drudge / init.js
Created August 8, 2012 02:11
Strip Trailing Whitespace mixin for Chocolat
/*!
* Strip Trailing Whitespace mixin for Chocolat
* Copyright(c) 2012 Nicholas Penree <[email protected]>
* MIT Licensed
*/
/**
* Hook up menu items.
*/
@drudge
drudge / README.md
Created August 8, 2012 12:40
Github Flavored Markdown mixin for Chocolat

Make sure to npm install github-flavored-markdown in the mixin directory.

@drudge
drudge / init.js
Created August 8, 2012 14:59
Convert to JS Array mixin for Chocolat
/*!
* Convert to JS Array mixin for Chocolat
* Copyright(c) 2012 Nicholas Penree <[email protected]>
* MIT Licensed
*/
/**
* Hook up menu items.
*/
@drudge
drudge / init.js
Created August 9, 2012 00:15
Transmit 4 mixin for Chocolat
/*!
* Transmit 4 mixin for Chocolat
* Copyright(c) 2012 Nicholas Penree <[email protected]>
* MIT Licensed
*/
/**
* Module dependencies.
*/