Yet another fortune clone, written in Go.
Besides that, what's different here?
- Uses simple text files. No effort has been done to re-implement parsing the strfiles as in original fortune and some other clones.
- Uses a streaming approach combined with reservoir sampling instead of reading whole files into memory first.
- Self-contained binary, only using the standard library. Fortune files are bundled via
go:embed.
tl;dr: simple, efficient and self-contained.
Just some ideas where you could use this.
Hook it into intramfs when you're feeling extra lucky. Take a look at this repository.
echo "~/path/to/gofort" >> ~/.bashrcecho "~/path/to/gofort" >> ~/.zshrcThe motd setup is distro-specific:
- On Debian and Ubuntu, the
update-motdmechanism can be used with a script that launches motd. - On Arch, it's a bit more complicated:
- One way to do it is described in this repo (replace the
update_motd.shwith your own script). - If you don't want to use PAM, you can of course also use a cronjob or systemd timer to regularly populate
/etc/motdwith a fortune by executing gofort.
- One way to do it is described in this repo (replace the