Skip to content

Instantly share code, notes, and snippets.

var stream = require('stream');
function streamify(text) {
var s = new stream.Readable();
s.push(text);
s.push(null);
return s;
}
streamify('foo\n').pipe(process.stdout);
@garthk
garthk / keybase.md
Created March 8, 2014 21:20
Claiming my part of the namespace.

Keybase proof

I hereby claim:

  • I am garthk on github.
  • I am garthk (https://keybase.io/garthk) on keybase.
  • I have a public key whose fingerprint is ACA0 364F 77B9 53D7 3D39 5F3B 3DE9 A3FD 46DE AB61

To claim this, I am signing this object:

node_modules
*.zip
@garthk
garthk / Dockerfile
Created March 27, 2014 09:42
Builds a .deb file for logstash-forwarder under Docker.
# logstash-forwarder debian build container
#
# usage:
#
# * copy this file into your logstash-forwarder checkout directory, then:
# * docker build -rm -t=lsfbuild .
# * docker run -rm -in lsfbuild ./tarout | tar xvf -
#
# result: logstash-forwarder_*.deb et al in your checkout directory without
# needing to have Ruby, GCC, or Go installed.
@garthk
garthk / autoprefix.plugin.js
Last active August 29, 2015 14:12
docpad-plugin-autoprefix-with-configuration
'use strict';
var autoprefixer = require('autoprefixer');
module.exports = function autoprefix(BasePlugin) {
return BasePlugin.extend({
name: 'autoprefix',
config: {
// fed straight to autoprefixer
@garthk
garthk / blat.js
Created March 8, 2015 23:00
blat lines from newline-separated JSON into redis for logstash to eat
#!/usr/bin/env node
// usage:
// blat.js &
// logstash agent -f inhale-all-seen.conf &
'use strict';
var fs = require('fs'),
redis = require('redis'),
@garthk
garthk / README.md
Created May 15, 2015 02:12
SaltStack dev setup in Docker container

First:

docker pull ubuntu:trusty # for fresh copy
docker run -t -i ubuntu:trusty

Then, in, the container:

export ARCHIVE=archive.ubuntu.com
export ARCHIVE=mirror.internode.on.net/pub/ubuntu

cat > /etc/apt/sources.list <

@garthk
garthk / set-up-root-and-intermediate-ca
Created May 26, 2015 04:11
set-up-root-and-intermediate-ca
#!/bin/bash
set -e
ROOT=/etc/pki/CA
ROOTKEY=$ROOT/private/ca.key.pem
ROOTCNF=$ROOT/openssl.cnf
ROOTCERT=$ROOT/certs/ca.cert.pem
ROOTDAYS=3650
INT=$ROOT/intermediate
INTKEY=$INT/private/intermediate.key.pem
@garthk
garthk / profile
Created June 21, 2015 23:51
boot2docker 1.7.0 cert fix
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
@garthk
garthk / README.md
Last active August 29, 2015 14:27
CentOS cleanup prior to taking AMI

A CentOS image straight off the marketplace shelf boots with the instance key loaded into authorized_keys for root. We prefer ec2-user. This new /etc/rc.d/rc.local helps, along with the pre-image procedure in ready.sh.