Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
"""Calculate the current package version number based on git tags.
If possible, use the output of “git describe” modified to conform to the
versioning scheme that setuptools uses (see PEP 386). Releases must be
labelled with annotated tags (signed tags are annotated) of the following
format:
v<num>(.<num>)+ [ {a|b|c|rc} <num> (.<num>)* ]
@wellsie
wellsie / travisci-aws-creds.sh
Last active August 29, 2015 14:04 — forked from kzap/gist:5819745
Shell script that adds AWS credentials from your environment and packages them in your projects .travis.yml file. The script accepts a file parameter that points the to a pem file that you wish to encrypt and include in your project. A symmetric key is generated and it itself is encrypted and included in your .travis.yml file. This key is used t…
#!/bin/sh
#
# Author:: Jono Wells ([email protected])
# http://oj.io
# Encrypt AWS creds for travis-ci
#
# Copyright 2014, Jono Wells
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@wellsie
wellsie / boot.js
Last active August 29, 2015 14:09 — forked from jdx/boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
var casper = require('casper').create();
var webpage = "http://wordpress.org/";
casper.on('resource.requested', function(resource) {
for (var obj in resource.headers) {
var name = resource.headers[obj].name;
var value = resource.headers[obj].value;
if (name == "User-Agent"){
@wellsie
wellsie / gist:7be4f8e536f53b567e0b
Last active June 7, 2017 10:49 — forked from tjcorr/gist:3baf86051471062b2fb7
CloudFormation to demo etcd-aws-cluster
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An etcd cluster based off an auto scaling group",
"Mappings" : {
"RegionMap" : {
"eu-central-1" : {
"AMI" : "ami-ffafb293"
},
"ap-northeast-1" : {
"AMI" : "ami-dae8c1b4"
@wellsie
wellsie / module_publish_to_aws_cloudwatch_logs.tf
Created January 18, 2016 06:36 — forked from conorgil/module_publish_to_aws_cloudwatch_logs.tf
Sharing IAM Role Policies between multiple IAM Roles
# AWS Cloudwatch Logs install documentation:
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/QuickStartEC2Instance.html
# By defining this IAM Role Policy in a module, it can be referenced anywhere it is required
# for an IAM Role. This is preferrable to copy/pasting the IAM Policy statement because changes
# made to this role will automatically apply to all IAM Roles referencing this module.
###
# Variables
###
@wellsie
wellsie / terraform-2tier-vpc
Created January 24, 2016 00:46 — forked from bluemalkin/terraform-2tier-vpc
Terraform 2 tier VPC with nat
# define some variables
variable "aws_ubuntu_ami" {
default = "ami-972444ad"
}
variable "aws_keypair" {
default = "xxxx"
}
# AWS account details
@wellsie
wellsie / az.bash
Created February 7, 2016 15:26 — forked from rfletcher/az.bash
List all AWS availability zones
# List all AWS availability zones
#
# Depends on:
# - `aws`: https://aws.amazon.com/cli/ (installed and configured with credentials)
# - `jq`: https://stedolan.github.io/jq/
#
for REGION in $(
aws ec2 describe-regions | jq --raw-output '.Regions | map(.RegionName) | .[]' | sort
); do
aws ec2 describe-availability-zones --region "$REGION" |
@wellsie
wellsie / k8s-release-urls.sh
Last active October 20, 2016 01:56 — forked from jbeda/gist:2cae7dd22a453c3caa94
URLs for kubernetes release artifacts
$ gsutil ls -R gs://kubernetes-release/release/v1.2.0 | sed 's|gs://kubernetes-release|https://storage.googleapis.com/kubernetes-release|; /^.*:$/d; /^$/d'
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-darwin-386.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-darwin-386.tar.gz.md5
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-darwin-386.tar.gz.sha1
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-darwin-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-darwin-amd64.tar.gz.md5
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-darwin-amd64.tar.gz.sha1
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-linux-386.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v1.2.0/kubernetes-client-linux-386.tar.gz.md5
https://storage.googleapis.com/kub
@wellsie
wellsie / install-ffmpeg-amazon-linux.sh
Last active March 28, 2016 04:20 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF