Skip to content

Instantly share code, notes, and snippets.

View joonathan's full-sized avatar

Joonathan Mägi joonathan

View GitHub Profile
@joonathan
joonathan / 0-to-60-with-kubernetes-and-isito.sh
Last active November 22, 2017 07:46
Line by line for "0 to 60 with Kuebrnetes and Istio" talk demos
aws s3api create-bucket --bucket kubernetes-example-co-uk-state-store-2 --region eu-central-1 --create-bucket-configuration LocationConstraint=eu-central-1 --profile kops
aws s3api put-bucket-versioning --bucket kubernetes-example-co-uk-state-store-2 --versioning-configuration Status=Enabled --profile kops
kops create cluster \
--zones "eu-central-1a,eu-central-1b,eu-central-1c" \
--master-zones "eu-central-1a,eu-central-1b,eu-central-1c" \
--master-count 3 \
--node-count 4 \
--topology private \
--networking kopeio-vxlan \
# -*- coding: utf-8 -*-
import json
import urllib2
from M2Crypto import X509
from base64 import b64decode
from M2Crypto.Err import M2CryptoError
SNS_MESSAGE_TYPE_SUB_NOTIFICATION = "SubscriptionConfirmation"
SNS_MESSAGE_TYPE_NOTIFICATION = "Notification"
SNS_MESSAGE_TYPE_UNSUB_NOTIFICATION = "UnsubscribeConfirmation"
### Keybase proof
I hereby claim:
* I am joonathan on github.
* I am joonathan (https://keybase.io/joonathan) on keybase.
* I have a public key whose fingerprint is A482 1228 CA37 A480 2CEE E813 92CE 40DB 0714 9D83
To claim this, I am signing this object:
@joonathan
joonathan / gist:1465380
Created December 12, 2011 06:25 — forked from jamescasbon/template.py
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()
import boto
# requires cf_customorigin branch
# https://github.com/boto/boto/tree/cf_customorigin
origin_domain = 'www.example.org'
cdn_cname = ['media.example.org']
caller_reference = 'exmaple Distribution'
c = boto.connect_cloudfront()
d = c.create_custom_distribution(
from django.db.models.signals import post_init
def track_data(*fields):
"""
Tracks property changes on a model instance.
The changed list of properties is refreshed on model initialization
and save.
>>> @track_data('name')
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
Save the supervisord.initscript script as /etc/init.d/supervisord
Run /usr/sbin/update-rc.d -f supervisord defaults