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
#!/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 / fault.py
Created July 24, 2019 16:04 — forked from kapilt/fault.py
import boto3
import random
def getconfig(key):
return {
'api-delay-services': ['ec2'],
'api-delay-range': [0, 3],
'api-delay-rate': 10,
'aws-fault-services': ['s3', 'dynamodb'],
'api-fault-rate': 10
@adhorn
adhorn / gist:11cd47b215547a413e825ce7c506c6ba
Created April 29, 2021 06:09 — forked from jacksonfdam/gist:3000275
Regular Expressions List
//Regular Expressions List
//Short Tutorial
\ // the escape character - used to find an instance of a metacharacter like a period, brackets, etc.
. // match any character except newline
x // match any instance of x
^x // match any character except x
[x] // match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z
| // an OR operator - [x|y] will match an instance of x or y
@adhorn
adhorn / exhaust_ephemeral_ports.py
Created February 21, 2022 14:21 — forked from ZuZuD/exhaust_ephemeral_ports.py
Simulate an ephemeral port exhaustion on a Linux client.
import socket
import time
import argparse
import subprocess
import shlex
"""
Usage: python3 exhaust_ephemeral_ports.py <dst> <dport> <optional:loop>
Example: python3 exhaust_ephemeral_ports.py 172.31.23.144 80
Help: exhaust_ephemeral_ports.py --help