Skip to content

Instantly share code, notes, and snippets.

View scottzach1's full-sized avatar
🐧

Zac Scott scottzach1

🐧
View GitHub Profile
@scottzach1
scottzach1 / astral-sh.md
Created June 10, 2025 05:40
Migrating ot Astral.sh Ecosystem

Migrating to Astral.sh Ecosystem

A complete Python toolchain

Problem Statement

Python development is plagued by fragmented, slow tooling. A typical project requires juggling multiple tools:

Package Management Chaos:

@scottzach1
scottzach1 / pnp-arch.md
Created June 7, 2025 22:28
Podman in Podman Rootless Arch Linux

Rootless Podman-in-Podman Setup Guide for Arch Linux

Disclaimer: This guide was generated by Claude Sonnet 4.

This guide covers setting up rootless Podman with support for running Podman containers inside Podman containers (Podman-in-Podman) on Arch Linux.

Prerequisites

Ensure you have a non-root user with sudo privileges and that your user has proper subuid/subgid mappings configured.

@scottzach1
scottzach1 / setup_arch.sh
Last active February 12, 2025 09:46
Arch Setup Script
#!/bin/bash
# Configuration variables
TARGET_DISK="XXX" # /dev/nvme0n1
SWAP_SIZE="16G"
HOSTNAME="desktop"
USERNAME="zaci"
TIMEZONE="Pacific/Auckland"
LOCALE="en_NZ.utf8"
KEYMAP="us"
@scottzach1
scottzach1 / aws_mfa_1pass.sh
Created October 14, 2024 21:24
AWS CLI MFA with 1password CLI lookup
#!/bin/bash
# Set the profile you want to use for MFA
SRC_PROFILE="default"
MFA_PROFILE="default-mfa"
MFA_DEVICE_ARN=$(aws configure get aws_mfa_device --profile "$SRC_PROFILE")
OP_VAULT_ITEM="<my-item-name>
if [ -z "$MFA_DEVICE_ARN" ]; then
echo "Error: MFA device ARN not found in the ~/.aws/credentials file for profile $SRC_PROFILE"
@scottzach1
scottzach1 / aws_mfa.sh
Created September 3, 2024 22:47
AWS CLI MFA
#!/bin/bash
# Set the profile you want to use for MFA
SRC_PROFILE="default"
MFA_PROFILE="default-mfa"
MFA_DEVICE_ARN=$(aws configure get aws_mfa_device --profile "$SRC_PROFILE")
if [ -z "$MFA_DEVICE_ARN" ]; then
echo "Error: MFA device ARN not found in the ~/.aws/credentials file for profile $SRC_PROFILE"
exit 1
@scottzach1
scottzach1 / flask_save_everything.py
Last active August 13, 2024 20:47
A quick Flask app that logs everything to disk.
"""
A quick Flask app that dumps everything to disk.
!!THIS IS NOT SAFE FOR PRODUCTION CODE!!
"""
from pathlib import Path
from flask import Flask, request, jsonify
import json
import time
@scottzach1
scottzach1 / redact.py
Last active June 25, 2024 22:11
A minimal wrapper to redact credentials in sys.stdout and sys.stderr
import io
import sys
class RedactIO(io.IOBase):
"""
A minimal io wrapper to redact sensitive data.
"""
def __init__(self, buffer, redactions: dict[str, str], **kwargs) -> None:
@scottzach1
scottzach1 / concurrent_runners.sh
Last active July 15, 2024 21:37
Bash script to configure multiple Self-hosted GitHub Runners
#!/bin/bash
# _ _ _ _
# ___ ___ ___ | |_| |_ ______ _ ___| |__ / |
# / __|/ __/ _ \| __| __|_ / _` |/ __| '_ \| |
# \__ \ (_| (_) | |_| |_ / / (_| | (__| | | | |
# |___/\___\___/ \__|\__/___\__,_|\___|_| |_|_|
#
# Zac Scott (github.com/scottzach1)
#
# A quick and hacky script to configure n self-hosted GitHub runners.
@scottzach1
scottzach1 / decorator_optional_arg.py
Created July 5, 2022 05:50
Python Decorator Optional Argument
#!/bin/python3
import functools
from typing import Callable
def wrapped(fn: Callable[..., str] = None, /, chars: str = '"') -> Callable[..., str] or str:
"""
A decorator to wrap a method response in quotes
@scottzach1
scottzach1 / nz_covid_tracer_usage_2021-09-12.csv
Created September 12, 2021 00:26
NZ Covid-19 Tracer Usage 12 09 2021
Date/Time From Date/Time To App Registrations QR Codes Generated NZBN Registered Businesses Scans Manual Entries Active Devices Bluetooth Active (24hr)
19/05/2020 12:00 20/05/2020 12:00 92595 1407 0
20/05/2020 12:00 21/05/2020 12:00 143405 5800 11411 11411 0
21/05/2020 12:00 22/05/2020 12:00 57000 4892 23561 23561 0
22/05/2020 12:00 23/05/2020 12:00 31000 1528 30275 30275 0
23/05/2020 12:00 24/05/2020 12:00 30000 31444 0
24/05/2020 12:00 25/05/2020 12:00 26000 29426 0
25/05/2020 12:00 26/05/2020 12:00 25000 3330 31629 0
26/05/2020 12:00 27/05/2020 12:00 17000 1510 36794 0
27/05/2020 12:00 28/05/2020 12:00 14000 1200 39216 0