Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am duggan on github.
  • I am duggan (https://keybase.io/duggan) on keybase.
  • I have a public key whose fingerprint is 9D02 FCF7 E7C1 1D58 826B 7E69 9271 ADA5 309F A120

To claim this, I am signing this object:

@duggan
duggan / gist:1b42cddf34c419db824d
Created August 2, 2014 21:47
RethinkDB: is it possible to supply ["foo", "def"] to a query on this table and return just the third document?
{
id: 1,
title: "Foo post",
tags: ["foo", "bar", "baz"]
},
{
id: 2,
title: "Bar post",
tags: ["abc", "def", "ghi"]
},
@duggan
duggan / licenses-centos7.txt
Created March 27, 2015 16:11
The various licenses and combinations thereof invoked on a freshly minted CentOS 7 server. `rpm -qa --qf "%{license}\n" | sort | uniq`
AFL and GPLv2+
ASL 2.0
BSD
BSD and GPLv2+
BSD and LGPLv2+ and GPLv2+ and Public Domain
BSD and LGPLv2 and Sleepycat
BSD or GPL+
BSD or GPLv2+
BSD with advertising
Copyright © 2014 The CentOS Project. All rights reserved.
@duggan
duggan / kitchen-manage.sh
Created March 27, 2015 16:45
Helper script for managing suspension/resumption of kitchen VMs. Workaround for Omnibus using Kitchen instead of Vagrant.
#!/bin/sh
show_help(){
cat <<-EOF
Manage running Kitchen instances.
suspend <NAME> Suspend a running kitchen instance.
resume <NAME> Resume a kitchen instance.
EOF
}
2015/05/14 18:46:30 terraform-provider-aws: panic: runtime error: invalid memory address or nil pointer dereference
2015/05/14 18:46:30 terraform-provider-aws: [signal 0xb code=0x1 addr=0x0 pc=0xb8d40]
2015/05/14 18:46:30 terraform-provider-aws:
2015/05/14 18:46:30 terraform-provider-aws: goroutine 102 [running]:
2015/05/14 18:46:30 terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.resourceAwsS3BucketRead(0xc20805bb00, 0x4ffa40, 0xc20804f2c0, 0x0, 0x0)
2015/05/14 18:46:30 terraform-provider-aws: /Users/mitchellh/code/go/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_s3_bucket.go:134 +0x3f0
2015/05/14 18:46:30 terraform-provider-aws: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc2081ffa40, 0xc208366810, 0x4ffa40, 0xc20804f2c0, 0xc2082a7830, 0x0, 0x0)
2015/05/14 18:46:30 terraform-provider-aws: /Users/mitchellh/code/go/src/github.com/hashicorp/terraform/helper/schema/resource.go:204 +0x43f
2015/05/14 18:46:30 terraform-provider-aws: gith
@duggan
duggan / s3-metadata.py
Last active August 29, 2015 14:25
Modify metadata headers for bucket objects parallellised on key prefixes. Based on Boto.
#!/usr/bin/env python
"""
Depends on boto (install with `pip install boto`).
usage: s3-metadata.py [-h] -a HEADER -b BUCKET [-p PREFIX] [-d]
Parallellized S3 metadata modifier.
optional arguments:
-h, --help show this help message and exit
@duggan
duggan / purge.py
Last active August 29, 2015 14:25
Delete bucket objects and remove them from CloudFlare's cache, parallellised on prefixes.
#!/usr/bin/env python
"""
Depends on boto and pyflare (install with `pip install boto pyflare`).
usage: purge.py [-h] -b BUCKET [-p PREFIX] -z ZONE [-d]
Parallellized S3 object and CloudFlare cache purger.
optional arguments:
-h, --help show this help message and exit
@duggan
duggan / receive.js
Created March 8, 2012 19:13
Node.js script. Spits out the headers of a request - useful for basic remote request testing
var http = require('http');
var qs = require('querystring');
/* Host / Port configuration.
Defaults to listening on all interfaces, port 80.
*/
var host = "0.0.0.0";
var port = 80;
http.createServer(function (req, res) {
@duggan
duggan / das-keyboard-uk-osx.xml
Created April 2, 2012 11:34
Das Keyboard UK Keyboard Layout for OSX
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!-- This goes in /Users/<username>/Library/Keyboard Layouts/daskeyboard.keylayout -->
<!-- Select it by checking the Das Keyboard option in System Preferences -> Languages & Text -> Input Sources -->
<keyboard group="0" id="2" name="Das Keyboard - UK" maxout="1">
<layouts>
<layout first="0" last="0" modifiers="commonModifiers" mapSet="ANSI"/>
</layouts>
<modifierMap id="commonModifiers" defaultIndex="0">
<keyMapSelect mapIndex="0">
@duggan
duggan / amzn-degraded-instances.py
Created April 3, 2012 02:50
Print degraded instances
import sys
from boto.ec2.connection import EC2Connection
from boto.exception import BotoServerError
AMZN_ACCESS_KEY = ""
AMZN_SECRET_KEY = ""
maintenance_instances = []
""" Get EC2 connection """