Skip to content

Instantly share code, notes, and snippets.

View adhorn's full-sized avatar

Adrian Hornsby adhorn

View GitHub Profile
@adhorn
adhorn / autoscale_sample
Created December 3, 2012 21:50 — forked from liamf/autoscale_sample
Demonstrates using patched boto to create an autoscaling group of servers, scaled up/down by CPU Utilisation
#################################################################################
# Import modules
#################################################################################
import os
import time
import sys
import socket
import string
@adhorn
adhorn / gitconfig
Last active November 4, 2015 12:26
Configuration file for GIT awesomness
[user]
name = Foo
email = [email protected]
[core]
excludesfile = /home/foobar/.gitignore_global
# color {{{
[color]
branch = auto
#!/usr/bin/env python
import optparse
import sys
from boto.s3.connection import S3Connection
def sign(bucket, path, access_key, secret_key, https, expiry):
c = S3Connection(access_key, secret_key)
return c.generate_url(
expires_in=long(expiry),
@adhorn
adhorn / nginx.conf
Last active January 3, 2024 03:09 — forked from mikhailov/gist:9639593
Nginx S3/Unicorn Proxy with backend keep alive
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@adhorn
adhorn / ssim-tests.py
Created August 4, 2017 15:24 — forked from ranman/ssim-tests.py
ssim-tests
import io
import os
import pprint
import boto3
import cv2
import numpy as np
from PIL import Image, ImageOps
from skimage import img_as_float
from skimage.measure import compare_ssim as ssim
@adhorn
adhorn / gist:997496feec26f217011e085a0f9fbc5c
Created April 24, 2018 07:13
Create DynamoDB Global Tables
#create the initial table with stream enabled (here in Ireland)
aws dynamodb create-table \
--table-name MyGlobalTable \
--attribute-definitions \
AttributeName=item_id,AttributeType=S \
--key-schema \
AttributeName=item_id,KeyType=HASH \
--provisioned-throughput \
ReadCapacityUnits=5,WriteCapacityUnits=5 \
--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \
@adhorn
adhorn / gist:0cad81d5fa394b98824e1c540bc24588
Created April 24, 2018 07:20
Test DynamoDB Global Tables
aws dynamodb put-item \
--table-name MyGlobalTable \
--item '{"item_id": {"S":"foobar"}}' \
--region eu-west-1
# then you can test by fetching the item created from tthe other region enabled.
aws dynamodb get-item \
--table-name MyGlobalTable \
--key '{"item_id": {"S":"foobar"}}' \
--region eu-central-1
@adhorn
adhorn / get.py
Last active April 25, 2018 03:12
from __future__ import unicode_literals
import sys
import logging
import boto3
import os
log = logging.getLogger()
log.setLevel(logging.DEBUG)
sys.path.insert(0, './vendored')
@adhorn
adhorn / env.yml
Last active April 25, 2018 03:11
STATUS: 200