Skip to content

Instantly share code, notes, and snippets.

@duggan
duggan / s3-metadata.py
Last active Aug 29, 2015
Modify metadata headers for bucket objects parallellised on key prefixes. Based on Boto.
View s3-metadata.py
#!/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 / mandelbrot.ps
Created Jul 21, 2015
PostScript for generating a Mandelbrot set.
View mandelbrot.ps
%!PS-Adobe-2.0
51 .5 551 { /x exch def 111 .5 721 { /y exch def y 521 sub 201 div x 301 sub 201 div 1 index 1 index 31 -1 1 { /n exch def 1 index dup mul 1 index dup mul 1 index 1 index add /d exch def sub 4 index add 3 1 roll 2 mul mul 2 index add d 4 gt {exit} if } for pop pop pop pop n 31 div setgray x y moveto .5 0 rlineto 0 .5 rlineto -.5 0 rlineto fill } for } for showpage
@duggan
duggan / cast.py
Last active Nov 28, 2020
Using pychromecast to headlessly stream youtube videos
View cast.py
#!/usr/bin/env python
"""
Requires pychromecast.
Install with `pip install pychromecast`
usage: cast.py [-h] -d DEVICE -v VIDEO
Cast YouTube videos headlessly.
View gist:316dd6b38e20fbb4a7a5
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 / kitchen-manage.sh
Created Mar 27, 2015
Helper script for managing suspension/resumption of kitchen VMs. Workaround for Omnibus using Kitchen instead of Vagrant.
View kitchen-manage.sh
#!/bin/sh
show_help(){
cat <<-EOF
Manage running Kitchen instances.
suspend <NAME> Suspend a running kitchen instance.
resume <NAME> Resume a kitchen instance.
EOF
}
@duggan
duggan / licenses-centos7.txt
Created Mar 27, 2015
The various licenses and combinations thereof invoked on a freshly minted CentOS 7 server. `rpm -qa --qf "%{license}\n" | sort | uniq`
View licenses-centos7.txt
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 / gist:1b42cddf34c419db824d
Created Aug 2, 2014
RethinkDB: is it possible to supply ["foo", "def"] to a query on this table and return just the third document?
View gist:1b42cddf34c419db824d
{
id: 1,
title: "Foo post",
tags: ["foo", "bar", "baz"]
},
{
id: 2,
title: "Bar post",
tags: ["abc", "def", "ghi"]
},
@duggan
duggan / check.php
Last active Jul 24, 2017
Get latest versions of a list of PHP PECL extensions
View check.php
<?php
/*
* Usage:
* $ php check.php --extensions="apc memcached redis"
* apc: 3.1.13
* memcached: 2.2.0
* redis: 2.2.5
*/
class PHPExtensionUpdates {
View keybase.md

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 / import-keypair
Last active Dec 23, 2015
Import public key to all EC2 regions. Required ec2-tools. Dedicated to @whiteley
View import-keypair
#!/bin/sh
#
# Imports a public key to all EC2 regions.
#
# Usage:
# sh import-keypair <name> <path>
#
# Example:
# sh import-keypair foo ~/.ssh/foo.pub
#