Skip to content

Instantly share code, notes, and snippets.

files:
"/tmp/barricade.sh" :
mode: "000700"
owner: root
group: root
source: <Your Barricade install.sh URL>
"/opt/elasticbeanstalk/tasks/taillogs.d/barricade.conf" :
mode: "000755"
owner: root
@duggan
duggan / Podcache.md
Last active December 22, 2015 17:47
Back up podcasts with metadata from a feed URL. Progress indicator and resuming.

Podcache

Back up podcasts with metadata from a feed URL. Progress indicator and resuming. Hacky, only really tested against FeedBurner/libsyn feeds.

When you run it, you get a directory named after the podcast with a list of mp3 files and metadata.json files.

tree /mnt/backups/podcast/
/mnt/backups/podcast/
@duggan
duggan / inventory.py
Created October 12, 2015 15:01
Present Terraform tfstate data as an Ansible inventory
#!/usr/bin/env python
import sys
import os
import json
import argparse
import collections
__description__ = """Ansible Dynamic Inventory for Terraform."""
__epilog__ = """
@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 December 5, 2024 20:30
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.