Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / mandelbrot.ps
Created July 21, 2015 12:50
PostScript for generating a Mandelbrot set.
%!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 November 28, 2020 21:55
Using pychromecast to headlessly stream youtube videos
#!/usr/bin/env python
"""
Requires pychromecast.
Install with `pip install pychromecast`
usage: cast.py [-h] -d DEVICE -v VIDEO
Cast YouTube videos headlessly.
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 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
}
@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 / 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 / check.php
Last active July 24, 2017 07:16
Get latest versions of a list of PHP PECL extensions
<?php
/*
* Usage:
* $ php check.php --extensions="apc memcached redis"
* apc: 3.1.13
* memcached: 2.2.0
* redis: 2.2.5
*/
class PHPExtensionUpdates {

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: