Skip to content

Instantly share code, notes, and snippets.

View adhorn's full-sized avatar

Adrian Hornsby adhorn

View GitHub Profile
adhorn /
Created February 21, 2022 14:21 — forked from ZuZuD/
Simulate an ephemeral port exhaustion on a Linux client.
import socket
import time
import argparse
import subprocess
import shlex
Usage: python3 <dst> <dport> <optional:loop>
Example: python3 80
Help: --help
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
Incident date:
Peer-review committee:
Supporting data:
Customer Impact:
Incident Response Analysis:
Post-Incident Analysis:
adhorn /
Created June 9, 2020 14:34
Randomly stopping instance via AWS Lambda
import boto3
import random
import time
def stop_random_instance(ec2_client, az_name, tag):
paginator = ec2_client.get_paginator('describe_instances')
pages = paginator.paginate(
adhorn / stop_random_instance_api.yml
Created June 1, 2020 12:55
Randomly stop EC2 instances using SSM Automation
description: Stop instances in a particular AZ with tag filter
schemaVersion: '0.3'
assumeRole: "{{ AutomationAssumeRole }}"
type: String
description: "(Required) The Availability Zone to impact"
type: String
adhorn / gist:f8ef67bbadafae4abe53c8e650b21936
Created April 30, 2020 14:22
AWS SSM Automation example
schemaVersion: '0.3'
description: Execute CPU stress via Run Command
assumeRole: "{{AutomationAssumeRole}}"
type: String
description: "The ARN of the role that allows Automation to perform the actions on your behalf."
default: ''
adhorn / gist:c315cb13331528b09f39a592344ec7cb
Created April 22, 2020 14:05
Chaos Toolkit experiment to stop docker locally
"version": "1.0.0",
"title": "What is the impact of an terminating the database master",
"description": "terminating the master database should not prevent the application from running",
"tags": ["db"],
"configuration": {
"endpoint_url": {
"type": "env",
"key": "ELEANOR_URL"
adhorn / gist:4659eb98428c83726ad4ff2ea19a27f9
Created April 8, 2020 05:35
IAM role - SSM Run (Send) Command
"Version": "2012-10-17",
"Statement": [
"Effect": "Allow",
"Action": [
adhorn / stop-random-instance-exp.json
Last active October 31, 2019 07:00
Chaos Toolkit experiement to ramdomly stop instances in an AZ (here eu-west-1b)
"version": "1.0.0",
"title": "What is the impact of randomly terminating an instance in an AZ",
"description": "terminating EC2 instance at random should not impact my app from running",
"tags": ["ec2"],
"configuration": {
"aws_region": "eu-west-1"
"steady-state-hypothesis": {
"title": "more than 0 instance in region",
adhorn /
Last active September 23, 2019 00:03
Example script to stop random ec2 instance in a particular AZ if that instance tag matches the input
import boto3
import random
REGION = 'eu-west-1'
def stop_random_instance(az, tag_name, tag_value, region=REGION):
>>> stop_random_instance(az="eu-west-1a", tag_name='chaos', tag_value="chaos-ready", region='eu-west-1')