Give a monkey a typewriter and infinite time, and it will eventually type the works of Shakespeare. That's the infinite monkey theorem .
I got bored of a normal GitHub profile README. So I put the theorem on mine.
Every day a GitHub Action hands my pixel monkey 10,000,000 random keystrokes and checks whether any of them landed on Hamlet. The stats update on the README. The longest match so far is "o the bla" — nine characters, somewhere in Act IV. At this pace, finishing the play takes about 10^237421 years. Cool.
The CLI the monkey pretends to run
$ monkey --type --keys = 10M # or, when someone feeds a banana: $ monkey --type --banana = @you
Enter fullscreen mode
Exit fullscreen mode
Under the hood it's just:
node scripts/monkey.mjs type # daily: 10M random keystrokes node scripts/monkey.mjs feed # banana issue: +1M keys + reply node scripts/monkey.mjs render # redraw SVGs + README from state
Enter fullscreen mode
Exit fullscreen mode
How the typing works
27 keys (a–z + space), uniform, via…