Skip to content

Instantly share code, notes, and snippets.

View iainelder's full-sized avatar

Iain Samuel McLean Elder iainelder

View GitHub Profile
@heitorlessa
heitorlessa / app.py
Last active February 11, 2025 16:44
Discord Powertools for AWS Lambda - Parsing EventBridge ECS Task State Change event
from __future__ import annotations
from typing import List, Optional
from aws_lambda_powertools.utilities.parser.models import EventBridgeModel
from aws_lambda_powertools.utilities.parser.envelopes import (
EventBridgeEnvelope, # only if you want to discard EventBridge metadata
)
from aws_lambda_powertools.utilities.parser.parser import event_parser
from pydantic import BaseModel
@benkehoe
benkehoe / dont-use-aws-s3-ls-to-check-credentials.md
Last active February 10, 2026 14:37
Use "aws sts get-caller-identity" instead of "aws s3 ls" for checking credentials

People shouldn't use aws s3 ls to check credentials

Here's why, and an SCP to stop them

Lots of people use aws s3 ls to check that they have valid credentials. If it succeeds, they assume they are good to go. Even AWS blog tutorials often use it. They're all wrong.

There's multiple things wrong with using aws s3 ls to check credential validity. The first is that it has an IAM permission, s3:ListAllMyBuckets, associated with it.

@atheiman
atheiman / Cfn-Stack.yml
Last active November 6, 2024 11:46
Run command across accounts and regions with SSM
AWSTemplateFormatVersion: '2010-09-09'
Description: >
SSM Automation Document run a custom SSM Command Document
against a fleet of target instances.
Parameters:
AutomationDocumentName:
Type: String
Description: Name of created SSM Automation Document
Default: MyAutomation
@zcapper
zcapper / aws-logs-glue.yaml
Last active September 11, 2023 14:59
This is a CloudFormation template that creates AWS Glue tables for your AWS logs so you can easily query your ELB access logs and CloudTrails in AWS Athena
AWSTemplateFormatVersion: 2010-09-09
Parameters:
LoggingBucket:
Description: The name of the S3 bucket that contains your AWS logs
Type: String
Resources:
GlueDatabase:
Type: AWS::Glue::Database
@mrcomoraes
mrcomoraes / clear_cache_MS_Teams.sh
Last active May 10, 2024 12:07
Clear cache Microsoft Teams on Linux
#!/bin/bash
# This script cleans all cache for Microsoft Teams on Linux
# Tested on Ubuntu-like, Debian by @necrifede, Arch Linux by @lucas-dclrcq and Manjaro with flatpak by @danie1k. Feel free to test/use in other distributions.
# Tested Teams via snap package.
# Tested Teams via flatpak package.
#
# How to use in terminal:
# ./clear_cache_MS_Teams.sh ( deb-stable | deb-insider | snap | flatpak )
# or
@justinvanwinkle
justinvanwinkle / broken.py
Last active November 7, 2025 09:11
Every python rate-limiting library (that I can find) is broken, at least a little.
# I was looking for a rate limiting library to call rate limited apis as closely
# as possible to their enforced limits. I looked at the first few python libraries
# that I found, and when I glanced at the source, they were all clearly broken.
# Curious how this could be, I took all the top google and pip search results for: python rate limiting
# and tried to get them to do the wrong thing and fail to rate limit in situations that could come up
# in normal use (though in some cases very specific use)
# https://github.com/tomasbasham/ratelimit
# Where broken:
@pkazi
pkazi / cloudTrailEventNames.list
Last active November 11, 2025 17:02
List of values for parameter EventName in AWS Cloudtrail events
AbortDocumentVersionUpload
AbortEnvironmentUpdate
AbortMultipartUpload
AbortVaultLock
AcceptAccountMapping
AcceptCertificateTransfer
AcceptDelegate
AcceptDirectConnectGatewayAssociationProposal
AcceptFxPaymentCurrencyTermsAndConditions
AcceptHandshake
@karlhorky
karlhorky / .yarnrc
Last active December 15, 2024 11:21
Configure Yarn's --silent flag with .yarnrc configuration file
--silent true
@weavenet
weavenet / console.py
Last active August 5, 2023 17:57
Python script to assume STS role and generate AWS console URL.
#!/usr/bin/env python
import getpass
import json
import requests
import sys
import urllib
import boto3
@Treer
Treer / gist:c7d7e33289b725dfb9d07718f6153a9d
Created December 11, 2016 13:18
Find most active fork of a github project
http://forked.yannick.io/