Something went wrong. Try again.
Central platform for European atproto.<cc> country community websites forked from atcommons.eu/website
Something went wrong. Try again.
website scripts
37 files
README.md
# Scripts
## estimate-nl-users.py
Approximates how many people in the Netherlands are on AT Protocol by sampling the
public Jetstream firehose. See the docstring at the top of the file, and the
methodology on `/community-size`.
```sh
uv run scripts/estimate-nl-users.py [seconds] [out.json]
```
Output is JSON: total posts, Dutch posts and their share, distinct Dutch-posting
accounts, resolved handle suffixes (.nl / .be / other), and the current Bluesky
account total from bsky.jazco.dev/stats.
Feed the numbers into `src/data/nl-estimate.ts`, rebuild, and redeploy.
### Why run it long
Dutch activity peaks in the evening (UTC+2). A short window over- or under-counts
depending on the time of day, so a representative figure needs a full day or more.
The script auto-reconnects across the whole window and writes `<out>.partial` every
five minutes so you can watch progress and survive a mid-run drop.
### Running a full day on a server
With uv installed:
```sh
uv run scripts/estimate-nl-users.py 86400 ~/atproto-nl/nl-24h.json
```
Or in a container (no local Python needed):
```sh
docker run --rm -v "$PWD:/w" -w /w python:3.12-slim sh -c \
"pip install -q websockets && python scripts/estimate-nl-users.py 86400 nl-24h.json"
```
Schedule a daily run with cron (adjust paths):
```cron
# 03:00 daily: sample the next 24h, write a dated result
0 3 * * * cd ~/atproto-nl/website && uv run scripts/estimate-nl-users.py 86400 "nl-$(date +\%F).json"
```
Averaging several daily results smooths out day-to-day and time-of-day variation.
## nl-stats-aggregate.py
Unions the feeder `.dids` files into the public `nl-stats.json` the `/stats` page reads.
```sh
uv run scripts/nl-stats-aggregate.py [--dir DIR] [--out nl-stats.json]
uv run scripts/nl-stats-aggregate.py --self-test
```
Each feeder writes a `<source>.dids` file (one DID per line) into a shared private
directory: `nl-live.json.dids` (Dutch posters), `nl-handles.dids` (`.nl` handles),
`starterpack.dids`, `sifa-nl.dids`. The aggregator deduplicates them into a singl…