Time-stamp: <2026-05-04 13h50 UTC> # Keeping track of thoughts.md as a webpage I realise that this is not exactly in the spirit of the smol web, and i have yet to decide on way to make this accessible over gemini, but here's a quick solution i found to scratch an itch i had. ## The "problem" I have a file called `thoughts.md` on my laptop, where i keep track of things that i ought to write down™ lest they become eroded by steady march of entropy, so that i have a central place where i can forget about things. But, and this is important, that file is on my laptop --- only. What if it wasn't? ## Enter python, bottle, nginx, systemd As i'm already hosting a website, what about a quick and dirty script that served a webpage with a textarea, and loaded the latest %YYYYMMDDHHMMSS.md file from a directory. If the user posts with "save", then make a new file. There are many, many features that this could grow, but for now having a text area i can reach from anyway, behind some auth'd endpoint from anywhere is all that i need. ## Implementation details This takes a tiny amount of glue, but here's the basic idea ```systemd unit file [Unit] Description=Note server After=network.target [Service] Type=simple DynamicUser=yes StateDirectory=notes WorkingDirectory=/var/lib/private/notes ExecStart=/usr/bin/python3 /usr/local/bin/note.py /var/lib/private/notes --host 127.0.0.1 --port NNN-CHANGE-ME Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` ```nginx config snippet location /CHANGE-ME-XXX { rewrite ^/CHANGE-ME-XXX/?(.*)$ /$1 break; proxy_pass http://127.0.0.1:18088; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; auth_basic "notes"; auth_basic_user_file /etc/nginx/.htpasswd; } ``` ```python webserver #!/usr/bin/env python3 import argparse import re from datetime import datetime from pathlib import Path import bottle from bottle import request, run def latest_file(directory: Path) -> Path | None: files = [p for p in directory.glob("*.md") if re.match(r"^\d{14}\.md$", p.name)] return max(files, key=lambda p: p.stat().st_mtime) if files else None def save(directory: Path, text: str) -> Path: filename = f"{datetime.now():%Y%m%d%H%M%S}.md" path = directory / filename _ = path.write_text(text, encoding="utf-8") return path def make_page(directory: Path) -> str: latest = latest_file(directory) content = latest.read_text(encoding="utf-8") if latest else "" filename = latest.name if latest else "(none)" return f"""