Skip to content

Instantly share code, notes, and snippets.

View andrewmackett's full-sized avatar

Andrew Mackett andrewmackett

View GitHub Profile
@joer14
joer14 / rds_download_log.py
Last active March 8, 2024 08:34
workaround for downloading rds logs via the AWS REST interface. This uses the IAM credentials for the session so should 'just work' on a lambda without needing to hardcode credentials/pass them in via environmental variables etc.
"""
Craft a web request to the AWS rest API and hit an endpoint that actually works but isn't supported in the CLI or in Boto3.
Based on this: https://github.com/aws/aws-cli/issues/2268#issuecomment-373803942
"""
import boto3
import os
import sys, os, base64, datetime, hashlib, hmac, urllib
import requests
@ArthurRocha
ArthurRocha / Athena ALB - Partitioned logs
Last active July 3, 2020 12:49
AWS Athena create table statement for Application Load Balancer logs (partitioned)
CREATE EXTERNAL TABLE IF NOT EXISTS {{DATABASE_NAME.TABLE_NAME}} (
type string,
time string,
elb string,
client_ip string,
client_port string,
target string,
request_processing_time int,
target_processing_time int,
response_processing_time int,
@TSMMark
TSMMark / delete_local_branches.sh
Last active February 20, 2023 05:41
Delete local branches that don't exist on remote/origin !USE AT YOUR OWN RISK!
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D