Skip to content

Instantly share code, notes, and snippets.

View lnattrass's full-sized avatar
💭
Hindsight is 50-50

Liam Nattrass lnattrass

💭
Hindsight is 50-50
View GitHub Profile
@lnattrass
lnattrass / split.py
Created August 25, 2020 20:16
Split Kubernetes Manifests to Directory
#!/usr/bin/env python3
import sys
import os
from ruamel.yaml import YAML
yaml = YAML()
infilename = sys.argv[1]
outfolder = sys.argv[2]
doc_counter=0

Keybase proof

I hereby claim:

  • I am lnattrass on github.
  • I am lnattrass (https://keybase.io/lnattrass) on keybase.
  • I have a public key ASAiDaqSyIhpdz7RbXj_zfXzt0figy6G19Hak4B-L0Hd7Ao

To claim this, I am signing this object:

@lnattrass
lnattrass / aws-autoscaling-rollout.py
Last active September 13, 2018 05:14
Based on https://github.com/AndrewFarley/farley-aws-missing-tools.. Includes a timeout function that reverts ASG settings.
#!/usr/bin/env python
##########################################################################################
#
# This script does a rollout of an autoscaling group gradually, while waiting/checking
# that whatever elasitc load balancer or target group it is attached to is healthy before
# continuing (if attached)
#
# This script leverages boto and the python aws scripts helper. There is no option to
# set the AWS region or credentials in this script, but boto reads from typical AWS
# environment variables/profiles so to set the region, please use the typical aws-cli
@lnattrass
lnattrass / get_tds_cert.py
Last active November 15, 2024 11:07
A terrible way to connect to MS SQL Server and dump the certificate as a PEM
import sys
import pprint
import struct
import socket
import ssl
from time import sleep
# Standard "HELLO" message for TDS
prelogin_msg = bytearray([ 0x12, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x06, 0x01, 0x00, 0x20,
0x00, 0x01, 0x02, 0x00, 0x21, 0x00, 0x01, 0x03, 0x00, 0x22, 0x00, 0x04, 0x04, 0x00, 0x26, 0x00,
@lnattrass
lnattrass / create-blank-ca.py
Created April 14, 2016 14:58
Create a CA that fails integrity check
import OpenSSL
key = OpenSSL.crypto.PKey()
key.generate_key(OpenSSL.crypto.TYPE_RSA, 2048)
ca = OpenSSL.crypto.X509()
ca.set_version(3)
ca.set_serial_number(1)
ca.get_subject().CN = "ca.example.com"
ca.gmtime_adj_notBefore(0)
ca.gmtime_adj_notAfter(24 * 60 * 60)