Skip to content

Instantly share code, notes, and snippets.

@kisst
kisst / redeploy-identitycenter-stack.sh
Created June 19, 2026 03:46
LZA #1088 workaround: redeploy AWSAccelerator-IdentityCenterStack by stripping/restoring Custom::IdentityCenterAssignments resources via change sets
#!/usr/bin/env bash
set -euo pipefail
# Workaround for landing-zone-accelerator-on-aws issue #1088:
# https://github.com/awslabs/landing-zone-accelerator-on-aws/issues/1088
#
# The Custom::IdentityCenterAssignments custom resources do not handle errors,
# so a failed assignment leaves the IdentityCenterStack stuck and it needs a
# manual redeployment. This script:
# 1. Finds the AWSAccelerator-IdentityCenterStack-* stack.
@kisst
kisst / download_aws_invoices.py
Created May 5, 2026 08:13
pre billing transfer get all invoices
#!/usr/bin/env python3
"""
Download all AWS invoices as PDFs for a given account over a date range.
Uses the AWS Invoicing API:
- invoicing:ListInvoiceSummaries -> enumerate invoices
- invoicing:GetInvoicePDF -> get a pre-signed S3 URL for each PDF
Note on retention:
AWS typically retains ~7 years of invoices. Anything older than that is
@kisst
kisst / cfn-template-snippet.yaml
Created May 2, 2025 07:14
Grok pattern and Setup for Datadog log parsing of AWS CloudFront Access logs
CloudFrontLogDestination:
Type: AWS::Logs::DeliveryDestination
Properties:
Name: !Sub "CloudFrontS3Destination-${MyCloudFrontDistribution}"
DestinationResourceArn: !Sub "arn:${AWS::Partition}:s3:::<insert your bucket name or ref here>"
OutputFormat: "plain" # has to be plain as json can't be handled by DD due to the brackets in the field naming
CloudFrontLogSource:
Type: AWS::Logs::DeliverySource
Properties:
@kisst
kisst / ssm-dependency-endpoints.py
Last active November 7, 2024 09:58
Quick script for quick debugging
import boto3
import os
import sys
# Initialize boto3 clients
ec2_client = boto3.client('ec2')
# Required VPC endpoint services
ENDPOINT_SERVICES = {
"com.amazonaws.{region}.ssm": "Interface",
@kisst
kisst / pyq.py
Created October 8, 2024 15:00
minimal python yaml query script
#!/usr/bin/env python3
import sys
import yaml
import os
def include_yaml(loader, node):
# Get the path of the file to include
file_path = os.path.join(os.path.dirname(loader.name), node.value)
@kisst
kisst / generate.sh
Last active September 23, 2024 10:03
AWS CloudShell Steampipe config generator for AWS Orgs
#!/bin/bash
# Ensure Steampipe is installed
if ! command -v steampipe >/dev/null; then
sudo /bin/sh -c "$(curl -fsSL https://steampipe.io/install/steampipe.sh)"
steampipe plugin install steampipe
steampipe plugin install aws
steampipe plugin update --all
fi
@kisst
kisst / fetch.py
Created March 26, 2023 11:38
timeanddata weather history scraper
#!/usr/bin/env python3
"""
Fetch weather data from timeanddate
"""
import re
import json
from datetime import date
import html
import pprint
import requests
@kisst
kisst / typeit.py
Last active October 3, 2022 13:14
One directional VDI proof "copy/paste"
#!/usr/bin/env python3
"""
Type the content of the file given in parameter
"""
import time
import sys
import pyautogui
# validate that we have something to type
if not len(sys.argv) == 2:
@kisst
kisst / im.list
Last active April 7, 2026 13:04
active IM solutions
name,url
2go,https://www.2go.im
3cx,https://www.3cx.com
activitypub,https://www.w3.org/TR/activitypub/
adamantmessenger,https://adamant.im
airchat,https://airchat.com
aprs,https://www.aprs.org
atak,https://tak.gov
ayoba,https://www.ayoba.me
bale,https://bale.ai
@kisst
kisst / code.py
Created August 24, 2021 10:21
rpi pico circuitpython demo
import board
import digitalio
import time
led = digitalio.DigitalInOut(board.GP25)
led.direction = digitalio.Direction.OUTPUT
def blink(count=1, delay=0.5):
for cv in range(count):
led.value = True