Skip to content

Instantly share code, notes, and snippets.

View alukach's full-sized avatar

Anthony Lukach alukach

View GitHub Profile
alukach / app.yaml
Last active April 2, 2024 02:40
An example Github Actions for Python + Pipenv + Postgres + Pyright
# .github/workflows/app.yaml
name: My Python Project
on: push
runs-on: ubuntu-latest
timeout-minutes: 10
alukach /
Last active February 12, 2024 17:12
AWS Helper Scripts
This script provides a CLI to select an AWS ECS Service and multiple RDS Instances
and makes the required Security Group edits to allow the ECS Service to make network
connections to the RDS Instances
from typing import List, Dict
import boto3
from botocore.exceptions import ClientError
alukach /
Last active February 5, 2024 20:05
Script to create a contractor group and multiple users on an AWS account
# Check if at least two arguments are provided (group name and at least one user)
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <GroupName> <User1> [<User2> ...]"
exit 1
# The first argument is the group name
alukach /
Created January 30, 2024 20:29
List bytes and objects per storage type for all buckets in an AWS account
import boto3
import csv
import threading
from datetime import datetime, timedelta
# List of storage types
storage_types = [
alukach /
Last active October 6, 2023 18:40
Parsing S3 Inventory results in Python
#! /usr/bin/env python3
A utility to stream records from one or many S3 Inventory reports, with a progress bar.
./parse-inventory-progress s3://my-bucket/path/to/my/inventory/2019-12-15T00-00Z/manifest.json > out.csv
import json
import csv
import gzip
import sys
alukach /
Created July 11, 2012 07:09 — forked from fuba/mpo2gif
Convert a .mpo file to an animated gif
# mpo2gif
# convert all .mpo files in a directory to a animation gif.
# Source:
# this idea is from
# this script requires exiftool and imagemagick.
for file in *.[Mm][Pp][Oo0]; do
alukach /
Created January 5, 2015 04:47
Custom Django Admin Form via Fake Model
from django.contrib import admin, messages
from django.http import HttpResponseRedirect
from django.shortcuts import render
from my_app.forms import CustomForm
class FakeModel(object):
class _meta:
app_label = 'my_app' # This is the app that the form will exist under
alukach /
Created May 4, 2023 05:21
Multiprocessing + Asyncio
An example of a script that does CPU-bound work (checksum calculation) followed by
IO-bound work (upload to server) in a performant manner.
import asyncio
import datetime
import hashlib
import multiprocessing
alukach /
Last active April 26, 2023 07:32
Should I use a NAT in my project?

A quick dump of criteria for deciding whether your project needs a NAT and, if so, what type it should be.

graph TD
    A(Do you need a NAT?) --> B
    B{Do you have services in a Private Subnet that\nneed to access resources outside of the network?}
    B -->|No| NotNeeded[You don't need a NAT]
    B -->|Yes| C
    C{Can you move those resources in a Public Subnet?} -->|Yes| PublicSubnet[Move to a Public Subnet instead] --> NotNeeded
alukach /
Last active December 23, 2021 06:58
AWS S3 Batch Operation boilerplate
import urllib
import boto3
from botocore.exceptions import ClientError
s3 = boto3.resource("s3")
TMP_FAILURE = "TemporaryFailure"
FAILURE = "PermanentFailure"