Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@markuman
markuman / README.md
Last active February 11, 2025 11:30
🗺️ OSM - self host the entire planet 🌎 in ~30 minutes 🚀

🗺️ OSM - self host the entire planet 🌎 in ~30 minutes 🚀

TL;DR

mkdir osm
wget -O osm/planet.mbtiles https://hidrive.ionos.com/api/sharelink/download?id=SYEgScrRe
podman run -ti --rm -p 9000:9000 --name sms -v $(pwd)/osm/:/data/ registry.gitlab.com/markuman/sms:latest
firefox http://localhost:9000
@fliepeltje
fliepeltje / app.py
Created July 25, 2024 10:28
FastAPI with boto3 on Fly.io
import os
import boto3
from fastapi import FastAPI
S3_URL = os.getenv("AWS_ENDPOINT_URL_S3")
svc = boto3.client('s3', endpoint_url=S3_URL)
app = FastAPI()
@app.get("/")
@pythoninthegrass
pythoninthegrass / bootstrap_acme
Last active October 24, 2024 20:31
acme.sh wrapper for godaddy (migrated from certbot)
#!/usr/bin/env bash
# shellcheck disable=SC2120
# exit on signals: 2, 1, 15
trap 'exit' SIGINT SIGHUP SIGTERM
# $USER
[[ -n $(logname >/dev/null 2>&1) ]] && logged_in_user=$(logname) || logged_in_user=$(whoami)
@jph00
jph00 / fasthtml-eg.sml.md
Last active January 8, 2025 16:13
FastHTML by example (small)

FastHTML By Example

An alternative introduction

There are lots of non-FastHTML-specific tricks and patterns involved in building web apps. The goal of this tutorial is to give an alternate introduction to FastHTML, building out example applications to show common patterns and illustrate some of the ways you can build on top of the FastHTML foundations to create your own custom web apps. A secondary goal is to have this be a useful document to add to the context of an LLM to turn it into a useful FastHTML assistant - in fact, in some of the examples we’ll see this kind of assistant in action, thanks to this custom GPT.

Let’s get started.

FastHTML Basics

@pythoninthegrass
pythoninthegrass / devbox
Last active July 12, 2024 17:11
Shim for devbox to automatically append --env-file to services argument
#!/usr/bin/env bash
# shellcheck disable=SC1091,SC2317
# shift shim behind real binary
export PATH="/usr/local/bin/:${PATH}"
# env vars
git_root="$(git rev-parse --show-toplevel 2>/dev/null)"
script_dir=$(dirname "$(readlink -f "$0")")
@pythoninthegrass
pythoninthegrass / Dockerfile.deadsnakes
Last active July 11, 2024 18:59 — forked from BillRaymond/gist:b39ae5d862aa81a250b70b812bd5d1cc
Dockerfile to build a specific version of Python and set it as the default using Deadsnakes
# syntax=docker/dockerfile:1.7
FROM ubuntu:20.04
ARG PYTHON_VERSION="3.11"
ENV TZ=US/Chicago
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
#!/usr/bin/env bash
@pythoninthegrass
pythoninthegrass / bootstrap.sh
Last active April 18, 2025 21:46
kind dev kubernetes cluster w/registry + metallb + nginx ingress
#!/usr/bin/env bash
# SOURCE: https://kind.sigs.k8s.io/docs/user/local-registry/
set -o errexit
# Global variables
reg_name='kind-registry'
reg_port='5001'
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
@pythoninthegrass
pythoninthegrass / README.md
Last active April 21, 2025 07:59
Bespoke askpass script for macOS

ask_pass

Bespoke askpass script for macOS.

NOTE

Moved to a proper repo as gists are pretty limited for organization.

Installation

@mgaitan
mgaitan / README.md
Created May 29, 2024 23:43
Playwright-pytest login just once per session (sharing storage state)

Simplest way to use Playwright sharing the "state" among tests.

The first test won't have the storage file so it will get a new empty page with no context and set it up / login.

Further tests will get a Page instance injected that has the same context as the first one, reusing the signed-in state.

Check https://playwright.dev/python/docs/auth#reusing-signed-in-state

@pythoninthegrass
pythoninthegrass / fedora-40.yml
Last active May 27, 2024 19:15
Lima custom YAML configs
# https://github.com/lima-vm/lima/blob/master/examples/docker-rootful.yaml
---
images:
# Hint: run `limactl prune` to invalidate the "current" cache
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2"
arch: "x86_64"
digest: "sha256:ac58f3c35b73272d5986fa6d3bc44fd246b45df4c334e99a07b3bbd00684adee"
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/aarch64/images/Fedora-Cloud-Base-Generic.aarch64-40-1.14.qcow2"
arch: "aarch64"
digest: "sha256:ebdce26d861a9d15072affe1919ed753ec7015bd97b3a7d0d0df6a10834f7459"