Skip to content

Instantly share code, notes, and snippets.

View niallo's full-sized avatar

Niall O'Higgins niallo

View GitHub Profile
(pyrenv)Niall-OHigginss-MacBook-Pro:pyrenv nialljohiggins$ paster create -t akhet
Selected and implied templates:
Akhet#akhet A Pylons-like Pyramid project
Enter project name: foobar
Variables:
egg: foobar
package: foobar
project: foobar
Enter sqlalchemy (Include SQLAlchemy configuration? (y/n)) [True]: n
@niallo
niallo / ubuntu-lucid-node-zeromq
Created March 8, 2012 21:02
Puppet class recipe to install Node.JS & ZeroMQ on Ubuntu 10.04 LTS / Lucid
class nodejs {
Package { ensure => "installed" }
$pkglist = [ "python-software-properties" ]
package { $pkglist: }
$apt-base = "/etc/sources.list.d/chris-lea"
Exec { require => package["python-software-properties"] }
@niallo
niallo / puppet-mongodb-10gen-ubuntu-10.04-lucid
Created March 8, 2012 22:11
Puppet module to run 10gen's MongoDB package on Ubuntu 10.04 LTS / Lucid
class mongodb {
$add-key = "/usr/bin/apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10"
$mongodb-repo = "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
Exec { require => Package["python-software-properties"] }
exec { "add-10gen-key":
command => $add-key,
onlyif => "/usr/bin/apt-key list | /usr/bin/awk '$0 ~ /10gen/ { exit 1 }' /etc/apt/sources.list"
@niallo
niallo / ubuntu-lucid-python-2.7
Created March 8, 2012 22:59
Puppet module to install & set default Python to 2.7 on Ubuntu 10.04 LTS / Lucid
class python27 {
Package { ensure => "installed" }
$apt-base = "/etc/apt/sources.list.d/fkrull-"
Exec { require => Package["python-software-properties"] }
exec { "python-repo" :
command => "/usr/bin/add-apt-repository ppa:fkrull/deadsnakes",
creates => "${apt-base}deadsnakes-lucid.list",
@niallo
niallo / s3-backups-init.pp
Created March 19, 2012 00:43
Automated, encrypted backups via Puppet, Duplicity and GnuPG
class s3-backups {
package { "duplicity":
ensure => "installed"
}
package { "python-boto":
ensure => "installed"
}
apres.getDataParamsFromElem = function(elem, paramKeys, prefix) {
var paramPrefix = prefix || "data-widget-";
var params = {};
for (var paramName in paramKeys) {
params[paramName] = elem.attr(paramPrefix + paramName);
}
return params;
}
@niallo
niallo / cal.c
Created July 10, 2012 16:30
"cal" program from V6 AT&T UNIX (release May 1975)
char dayw[]
{
" S M Tu W Th F S"
};
char *smon[]
{
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec",
};
@niallo
niallo / gist:3484450
Created August 26, 2012 23:50
project type detection heuristic predicate
// Detection predicate for Python language & known frameworks
{
// "exists" property can be a glob as supported by node-glob
// https://github.com/isaacs/node-glob
//
// "grep" property is a JavaScript regular expression as described at
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp
// grep looks for the regular expression inside of the
// Array predicates have an implicit OR
@niallo
niallo / gist:3863486
Created October 10, 2012 06:27
node 0.8.11 stdout/stderr setEncoding('utf8') strangeness
var assert = require('assert')
var spawn = require('child_process').spawn
function runTest(cb) {
var proc = spawn("/usr/bin/env", [], {env:{foo:"bar"}})
proc.stdoutBuf = ""
proc.stderrBuf = ""
proc.stdmergedBuf = ""
//
// Node Child Process Spawn() race bug
//
// Triggerable on:
// Node 0.8.11 / OS X 10.8.2 / MBP 13" 2011 (4 cores)
// Doesn't seem to happen on:
// Node 0.8.11 / Ubuntu 10.04 LTS / EC2 Medium (1 core)
var assert = require('assert')