Skip to content

Instantly share code, notes, and snippets.

View bmritz's full-sized avatar

Brian Ritz bmritz

  • Graham Allen Partners
  • South Bend, Indiana
  • 02:46 (UTC -04:00)
View GitHub Profile
REQUIRED := python3.11 curl
$(foreach bin,$(REQUIRED),\
$(if $(shell command -v $(bin) 2> /dev/null),,$(error Please install `$(bin)`)))
REPOSITORY_ROOT := $(PWD)
.poetry/bin/poetry: ## install poetry
@curl -sSL https://install.python-poetry.org | POETRY_HOME=$(REPOSITORY_ROOT)/$(shell basename $(dir $(abspath $(dir $(@))))) python3.11 - --version=1.4.2
#!/bin/bash
# Default number of words
NUM_WORDS=${1:-4}
# Generate a passphrase with a variable number of easily understood words separated by hyphens
shuf -n "$NUM_WORDS" /usr/share/dict/words | tr '\n' '-' | sed 's/-$//' | sed 's/$/\n/'
@bmritz
bmritz / test_db_with_template_databases.py
Created December 30, 2024 21:31
This shows how to use a postgres database template to run each test on an isolated instance of a test database with good performance
import datetime
import os
import random
import string
import time
import uuid
import asyncpg
import pytest
import pytest_asyncio