Skip to content

Instantly share code, notes, and snippets.

@gardner
gardner / gist:22f2fb13cf2103f7a0197437dfa71bc8
Created October 5, 2026 22:13
.pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: file-length
name: Maximum 500 lines per Python source file
entry: uv run --locked python scripts/check_file_length.py
args: [--max-lines, "500"]
language: system
files: \.py$
exclude: (^|/)(tests?(/|\.py$)|test_[^/]*\.py$|[^/]*_test\.py$|conftest\.py$)
@gardner
gardner / AGENTS.md
Last active October 16, 2026 00:47

Package Managers

Use uv run main.py Use uv add <dependency> to always get the latest version

Perfer pnpm instead of npm where possible.

Static Code Analysis

To ensure code quality stays high and readable: Use strong types, code formatting, max-lines-per-file, and complexity detection. See: https://gist.github.com/gardner/22f2fb13cf2103f7a0197437dfa71bc8

What I Worked On
February 2021
Before college the two main things I worked on, outside of school, were writing and programming. I didn't write essays. I wrote what beginning writers were supposed to write then, and probably still are: short stories. My stories were awful. They had hardly any plot, just characters with strong feelings, which I imagined made them deep.
The first programs I tried writing were on the IBM 1401 that our school district used for what was then called "data processing." This was in 9th grade, so I was 13 or 14. The school district's 1401 happened to be in the basement of our junior high school, and my friend Rich Draves and I got permission to use it. It was like a mini Bond villain's lair down there, with all these alien-looking machines — CPU, disk drives, printer, card reader — sitting up on a raised floor under bright fluorescent lights.
The language we used was an early version of Fortran. You had to type programs on punch cards, then stack them in the card reader and press a
@gardner
gardner / grant_research_dify.md
Last active February 10, 2025 07:16
A dify bot doing grant research

Grants and Funding for not-for-profit organizations in New Zealand

Exploring Government Grants for New Zealand Nonprofits

Research Report: Government Grants for New Zealand Nonprofits
  1. Overview of Government Funding Sources
  • Primary funding provider: Department of Internal Affairs' Community Operations
  • Funding programs include:
    • Lottery grants
  • Crown grant funding
@gardner
gardner / grant_research.md
Created February 10, 2025 03:50
Grant Research

Funding Opportunities for Community-Based Education Organizations in Nelson, New Zealand

Date: 07/02/2025

Introduction

Community-based education organizations in Nelson, New Zealand, play a crucial role in fostering educational development and social cohesion. These organizations often rely on external funding to sustain their operations and expand their impact. In recent years, a variety of funding opportunities have emerged, ranging from traditional grants provided by local councils and foundations to innovative funding mechanisms such as cryptocurrency and blockchain-based solutions. The Nelson City Council's Community Investment Fund (CIF) is a notable example, offering financial support to projects that align with the city's social development goals (Nelson City Council). Additionally, the Rātā Foundation provides significant funding across the South Island, focusing on ed

@gardner
gardner / cweb_folder_action.sh
Created August 6, 2024 05:03
A macOS folder action that converts files to webp format
#!/usr/bin/env bash -x
export PATH="${PATH}:/opt/homebrew/bin"
for f in "$@"; do
ABSOLUTE_F=$(readlink -f "$f")
# Check if the file is an image
MIME_TYPE=$(file --mime-type -b "$ABSOLUTE_F")
EXT="${ABSOLUTE_F##*.}"
@gardner
gardner / gist:9760e52201ae9673f8b6c8935ee95619
Created December 1, 2023 11:05
Create "animated gif" mp4
ffmpeg -i demo.mov \
-vf "fps=5,scale=1280:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-y demo.mp4
@gardner
gardner / gist:78721ccceaf9d341d9b27ae2ba1366ca
Created December 1, 2023 02:06
ffmpeg macos settings test for h264_videotoolbox
#!/bin/bash
for profile in baseline main high; do
for level in 30 31 32 40 41 42 50 51 52; do
echo output-$profile-$level.mp4
ffmpeg -i high-res.mov \
-c:v h264_videotoolbox -profile:v $profile -level $level \
-c:a aac \
-y \
output-$profile-$level.mp4
@gardner
gardner / jail.local
Created September 1, 2022 21:18
fail2ban with authelia
[authelia]
enabled = true
port = http,https,9091
filter = authelia
logpath = /var/log/authelia/authelia.log
maxretry = 3
bantime = 1d
findtime = 1d
chain = DOCKER-USER
@gardner
gardner / pre-push
Created January 15, 2022 00:33
Versioning a React app in a monorepo with no tags
#!/bin/sh
cd $(git rev-parse --show-toplevel)/ui
previous=$(npm version | grep rating-ui | awk -F"'" '{ print $4 }')
tickets=$(git log --oneline ./ | awk '{ print tolower($2) }' | sort | uniq | grep -i -E -o 'MX-[0-9]+' | wc | awk '{ print $1 }')
patch=$(($tickets % 10))
minor=$(($tickets % 100))
minor=${minor:0:1}
major=$(($tickets % 1000))
major=${major:0:1}