Skip to content

Instantly share code, notes, and snippets.

View stigok's full-sized avatar
🚢
ship it!

Stig Otnes Kolstad stigok

🚢
ship it!
View GitHub Profile
@stigok
stigok / 000001_first.down.sql
Created August 14, 2025 13:04
psql jsonb migration example
-- empty
#!/usr/bin/env python3
# ruff: noqa: E501
"""
Given a regular expression pattern containing certain named capture groups,
print a line to stdout for each match found in `infile`. The printed messages
is in a format that will annotate code in a GitHub pull request.
See the source code of this program for usage examples.
See GitHub command reference for more information.
@stigok
stigok / timing_resistant.py
Created October 13, 2025 08:53
An attempt to create a decorator for spending at least n seconds before returning from an awaitable/
import asyncio
from functools import wraps
from typing import Any
from collections.abc import Awaitable
def await_at_least(fn: Awaitable[Any], *, seconds: int):
"""
Do not return from the decorated function until at least `seconds`
have passed.