Skip to content

Instantly share code, notes, and snippets.

View dpetzold's full-sized avatar

Derrick Petzold dpetzold

View GitHub Profile
#!/usr/bin/python3
"""
A tool to convert camelcase field names in JSON to snake case. Helps with converting
AWS dumps to terraform HCL. For example:
```
$ aws cloudfront get-distribution --id <id> --query Distribution > dist.json
$ python3 terraform_case.py dist.json dist.tf
```
@dpetzold
dpetzold / find_elb_by_ip.py
Created February 24, 2019 05:10
Find a ElasticLoadBalancer (ELB) by its ip address
import boto3
import socket
import argparse
client = boto3.client('elb')
def find_elb_by_ip(ip):
paginator = client.get_paginator('describe_load_balancers')
response_iterator = paginator.paginate()

Keybase proof

I hereby claim:

To claim this, I am signing this object:

#!env python3
"""
Given an ACM certificate ARN generate Terraform to create resources for an aws_acm_certificate_validation to pass.
$ generate-certificate-validation.py <certificate arn>
/************************** new.example.com ********************************/
data aws_route53_zone example_com_zone {
name = "example.com."
}
@dpetzold
dpetzold / radb.py
Last active October 24, 2019 06:58
Query whois.radb.net
import functools
import logging
import socket
import whois
logger = logging.getLogger(__name__)
@functools.lru_cache(maxsize=1)
clear Mod1
clear Mod4
clear Control
keycode 64 = Alt_L
keycode 37 = Super_L
keycode 134 = Control_L
add Mod4 = Alt_L
add Mod1 = Control_L
add Control = Super_L
@dpetzold
dpetzold / gist:b216b2ee7d0b7a409f556ecf764ed8ef
Created June 25, 2020 04:47
Debug S3 calls with mitmproxy
docker run -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy --rm -it -p 443:8080 mitmproxy/mitmproxy mitmdump --flow-detail 2 --ssl-insecure --mode reverse:https://s3.amazonaws.com:443