Skip to content

Instantly share code, notes, and snippets.

View schlarpc's full-sized avatar

Chaz Schlarp schlarpc

View GitHub Profile
@schlarpc
schlarpc / enable-local-zones.py
Created December 31, 2023 08:11
boto3 enable all local zones
import boto3
ec2 = boto3.client("ec2", region_name="us-east-1")
for region in ec2.describe_regions()["Regions"]:
regional_ec2 = boto3.client("ec2", region_name=region["RegionName"])
done = set()
for zone in regional_ec2.describe_availability_zones(AllAvailabilityZones=True)["AvailabilityZones"]:
if zone["OptInStatus"] == "opted-in":
response = regional_ec2.get_paginator("describe_spot_price_history").paginate(
AvailabilityZone=zone["ZoneName"],
@schlarpc
schlarpc / webm.py
Created December 31, 2023 08:04
catbox webm maker
import subprocess
import argparse
import requests
import tempfile
import decimal
import pathlib
import shutil
import urllib.parse
MAX_FILESIZE = 1024 * 1024 * 4 * 95 // 100 # 4MB with 95% fudge factor
@schlarpc
schlarpc / states-py.py
Created December 31, 2023 08:00
work-in-progress encoding of AWS Step Functions states language as python
import ast
import inspect
import hashlib
import json
import base64
import random
import re
import itertools
import time
import uuid
@schlarpc
schlarpc / speechmarks.py
Created August 7, 2023 16:52
aws polly speechmarks parser
import boto3
import enum
import json
import itertools
import streamp3
import dataclasses
from typing import Tuple, Dict, Optional
polly = boto3.client("polly")
@schlarpc
schlarpc / default.nix
Created April 10, 2023 17:34
hash-speedtest
{ pkgs ? import <nixpkgs> {} }:
let
libkcapi = pkgs.stdenv.mkDerivation {
pname = "libkcapi";
version = "a05976bef9c4d4dbe48323e8cdbe2c886f35b9ff";
src = pkgs.fetchFromGitHub {
repo = "libkcapi";
owner = "smuellerDD";
rev = "a05976bef9c4d4dbe48323e8cdbe2c886f35b9ff";
sha256 = "sha256-TjTER1AiPyILOx+oyZmt0WSPxEMo0oP+dAYZK6O3BM4=";
@schlarpc
schlarpc / 2020-22 Elerts Restroom Reports.csv
Created December 3, 2022 04:38
port of seattle / seatac bathroom maintenance requests
We can't make this file beautiful and searchable because it's too large.
Report ID,Image,Date,Time,Status,Title,Type,Location,Details,User ID,Lat,Lon,Notes,Tags,Chat,Source
32653,"[""https://s3.amazonaws.com/img_elerts/report_images/thumbs/elert__1168348_823b52ce96449b3ea8f95efdef5d1d2d.jpg"",""https://s3.amazonaws.com/img_elerts/report_images/thumbs/elert__1168348_823b52ce96449b3ea8f95efdef5d1d2d.jpg"",""https://s3.amazonaws.com/img_elerts/report_images/thumbs/elert__1168348_4be5d649a8764a113c035e55b50a3fbf.jpg"",""https://s3.amazonaws.com/img_elerts/report_images/thumbs/elert__1168348_823b52ce96449b3ea8f95efdef5d1d2d.jpg""]",11/21/2022,1:02pm,Closed,IAF,Restroom,IAF,"""In the Secondary/Agriculture International arrivals side. Bathroom is heavily clogged. Door number IAF 5283C C.""",ANONYMOUS,47.44038,-122.297699,,,"[{""timestamp"":""11/21/2022 1:03pm"",""name"":""Cody Proulx"",""message"":""maintenance is aware, should be addressing it shortly""},{""timestamp"":""11/21/2022 1:11pm"",""name"":""Karen Desenuts"",""message"":""Alright its 2 toilets that are clogged! The ones one t
@schlarpc
schlarpc / cloudformation.nix
Created March 8, 2021 01:39
CloudFormation functions as Nix expressions
GetAtt = resource: attribute: { "Fn::GetAtt" = [ resource.logical_id attribute ]; };
Ref = resource: { "Ref" = [ resource.logical_id ]; };
Split = delimiter: string: { "Fn::Split" = [ separator string ]; };
Sub = template: values: { "Fn::Sub" = [ template values ]; };
Select = index: values: { "Fn::Select" = [ index objects ]; };
Join = delimiter: values: { "Fn::Join" = [ delimiter values ]; };
FindInMap = name: key1: key2 { "Fn::FindInMap" = [ name key1 key2 ]; };
Base64 = value: { "Fn::Base64" = value };
ImportValue = name: { "Fn::ImportValue" = name; };
GetAZs = region: { "Fn::GetAZs" = region; };
@schlarpc
schlarpc / enable-shadowplay-task.xml
Created January 8, 2021 20:58
Enable ShadowPlay on computer unlock (RDP fix)
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2021-01-08T12:52:30.0596384</Date>
<Author>MUFFIN\User</Author>
<URI>\Enable ShadowPlay</URI>
</RegistrationInfo>
<Triggers>
<LogonTrigger>
<Enabled>true</Enabled>
@schlarpc
schlarpc / aws-logout.user.js
Last active March 16, 2022 18:55
aws-logout.user.js
// ==UserScript==
// @name AWS Console Federation Autologout
// @match https://signin.aws.amazon.com/federation?*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let logout = document.querySelector('a[href^="/oauth?Action=logout"]');
if (logout) {
let iframe = document.createElement("iframe");
#!/usr/bin/env python3
import itertools
import operator
import math
import collections
import os
import types
import re
import sys