Santōka Every Hour
A microblog bot that posts a random haiku by Santōka Taneda every hour.
Credits
- Haiku written by Taneda Santōka.
- Collected by Gábor Terebess and all his various sources.
- Compiled/normalized by Luca.
- Bot by me (Ian).
Tech
Live at
- Bluesky @santokaeveryhour.skalk.id
- Mastodon @santokabot@botsin.space
- Twitter @hourlysantoka
The Algo
I'm aiming at a good enough deterministic random poem every hour. Here's how it works:
- Grab a seeded Knuth shuffle of all the poems where the seed is
hours since epoch / number of poems
. This gives us the currentcycle
index. - Grab the
n
th poem, wheren
is the current hour since the beginning ofcycle
. - Post to Bluesky, Mastodon, and Twitter when /haiku is called from an authenticated cron job
At the moment, there are enough poems to go about 27 days without any repeats. Since it's based off of a timestamp, it's also statess, so the order is preserved between deployments, between restarts, etc etc.
Dev
- Create a .env (see
.env.example
) - Install deps
bun install # Or whatever package manager you use
- Run the dev server
bun run dev
- Go to http://localhost:5173/haiku to get your haiku for the hour! ✨
Ideas/variations for the future
- Pick an appropriate poem based on the weather in a location (find a way to trace where he walked in Japan and pick weather from there?)
- Special birthday post? (Dec 3)
- Reply to @'s with a contextually appropriate poem (RAG search or tags?)
AI Santoka - Fine-tune an LLM to generate new haikuEh, feels greasier now than when I wrote this one 😕
Buy me a coff- uhhh serverless function
Cron jobs cost money. Not a lot, but some. If you like this bot and want me to make more, consider dropping a tip to help keep it (and sites like my portfolio, which helps me land gigs that buy me food and such) running.
Any donations that exceed the price of Vercel Pro will probably go to the Trevor Project or Mermaids or something. Idk. Drop me a line if you have a suggestion.