Skip to content

Instantly share code, notes, and snippets.

@zigg
zigg / index.js
Created May 31, 2016
express-winston res.end testcase
View index.js
'use strict';
const express = require('express');
const expressWinston = require('express-winston');
const stream = require('stream');
const winston = require('winston');
const app = express();
const requestLogger = new expressWinston.logger(({
@zigg
zigg / create_dmg.sh
Created Nov 4, 2015
Create a DMG installer for installing El Capitan into a VM
View create_dmg.sh
# Based on Tim Sutton's prepare_iso.sh from the excellent osx-vm-templates
# <https://github.com/timsutton/osx-vm-templates/blob/master/prepare_iso/prepare_iso.sh>
hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg
hdiutil create -o tmp.dmg -size 10g -layout SPUD -fs HFS+J
hdiutil attach tmp.dmg
asr restore --source /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg --target /Volumes/untitled --erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -Rv /Volumes/OS\ X\ Install\ ESD/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -v /Volumes/OS\ X\ Install\ ESD/BaseSystem.* /Volumes/OS\ X\ Base\ System/
@zigg
zigg / out-vs-err.sh
Last active Jun 28, 2020
makes output on both stdout and stderr
View out-vs-err.sh
#!/bin/sh
#
# This script outputs "stdout" to stdout and "stderr" to stderr.
#
# Try it like this and observe the differences:
#
# out-vs-err.sh 2>&1 >/dev/null
# out-vs-err.sh >/dev/null 2>&1
#
# See <http://stackoverflow.com/questions/10508843/what-is-dev-null-21/10508862#comment48709328_10508843>
View 01.configure
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking for --without-gcc... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/private/tmp/python-50OT/Python-2.7.7':
View bots.rb
#!/usr/bin/env ruby
require 'twitter_ebooks'
# This is an example bot definition with event handlers commented out
# You can define as many of these as you like; they will run simultaneously
Ebooks::Bot.new("zigg_ebooks") do |bot|
# Consumer details come from registering an app at https://dev.twitter.com/
# OAuth details can be fetched with https://github.com/marcel/twurl
@zigg
zigg / otr.txt
Last active Aug 29, 2015
OTR fingerprint
View otr.txt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am zigg on the Freenode IRC network (irc.freenode.net), and my
OTR fingerprint is A70E860E D07F0F4E 45AE0274 1F981806 8B3F562E.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBAgAGBQJTkIC5AAoJEKtGgj/PvysTLVcQAIp03kV+nQse7stwf96eWg4x
@zigg
zigg / playbook.yml
Created Apr 1, 2014
First attempt to provision and configure a droplet with Ansible
View playbook.yml
# First attempt to provision and configure a Digital Ocean droplet
# using Ansible.
#
# After you run this the first time, you have to fill in the droplet
# id it prints into the id= parameter of the digital_ocean task. From
# there on out it's idempotent.
- hosts: 127.0.0.1
connection: local
gather_facts: False
@zigg
zigg / keybase.md
Created Mar 6, 2014
Keybase.io proof
View keybase.md

Keybase proof

I hereby claim:

  • I am zigg on github.
  • I am zigg (https://keybase.io/zigg) on keybase.
  • I have a public key whose fingerprint is E043 900F 94AF E80A 7633 65F4 AB46 823F CFBF 2B13

To claim this, I am signing this object:

@zigg
zigg / gpgstatusfd.py
Created Jan 6, 2014
blocking read from gpg status-fd
View gpgstatusfd.py
#!/usr/bin/env python3.4
import os
import subprocess
fd_r, fd_w = os.pipe()
try:
p = subprocess.Popen(
[
@zigg
zigg / catclient.py
Last active Jan 2, 2016
a client for /bin/cat in Python 3.4 asyncio
View catclient.py
#!/usr/bin/env python3.4
import asyncio
class CatClient(asyncio.SubprocessProtocol):
"""meows at /bin/cat"""
You can’t perform that action at this time.