Skip to content

Instantly share code, notes, and snippets.

View niallo's full-sized avatar

Niall O'Higgins niallo

View GitHub Profile
@niallo
niallo / gist:5288738
Last active December 15, 2015 16:19
docker shell interaction oddity
Hangs:
$ cat > builder.sh
apt-get update
apt-get install -y wget
wget --help
$ docker run -i -t base /bin/bash < builder.sh
Doesn't hang:
@niallo
niallo / strider-custom.json
Created March 21, 2013 17:49
Example of a strider-custom.json for a Go project
{
"prepare":"GOROOT=/opt/node/go GOBIN=/opt/node/bin/go make",
"test":"GOROOT=/opt/node/go GOBIN=/opt/node/bin/go make test",
"deploy":"echo a custom deploy command executed on test success"
}
@niallo
niallo / app.js
Created March 2, 2013 00:43
Quick and dirty landing page & contact form server in node.js, uses hapi.js, swig and nodemailer.
var mailer = require('nodemailer')
var Hapi = require('hapi')
var util = require('util')
var template = require('swig')
var path = require('path')
var PORT = process.env.PORT || 8080
var server = new Hapi.Server(PORT)
template.init({
<?php
// Get this at your MongoLab.com user page
$MONGOLAB_API_KEY = 'XXXXXXXXXXXXXX';
$DB = 'mydb';
$COLLECTION = 'mycollection';
$name = $_POST['fullName'];
$email = $_POST['email'];
$phone = $_POST['phoneNumber'];
$src = $_POST['src'];
//
// 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')
@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 = ""
@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:3109252
Created July 14, 2012 04:54
Parse Github `Links` header in JavaScript
/*
* parse_link_header()
*
* Parse the Github Link HTTP header used for pageination
* http://developer.github.com/v3/#pagination
*/
function parse_link_header(header) {
if (header.length == 0) {
throw new Error("input must not be of zero length");
}
@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:3029840
Last active October 1, 2017 16:11
Sample Strider Webhook Payload
{ "test_results":
{ "deploy_exitcode": null,
"finish_time": "2012-06-29T00:19:26.622Z",
"repo_url": "https://github.com/niallo/gh-markdown-cli",
"start_time": "2012-06-29T00:19:04.538Z",
"github_commit_id": "f84bda271dc884fd6b2c0badc001f8fefcacdc9f",
"test_exitcode": 0
}
}