https://github.com/kdevo/gofort
Yet another fortune clone, written in Go.
https://github.com/kdevo/gofort
Last synced: 4 months ago
JSON representation
Yet another fortune clone, written in Go.
- Host: GitHub
- URL: https://github.com/kdevo/gofort
- Owner: kdevo
- Created: 2021-08-28T11:48:39.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-28T23:09:31.000Z (almost 5 years ago)
- Last Synced: 2024-06-20T08:02:04.425Z (almost 2 years ago)
- Language: Go
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gofort
[](https://github.com/kdevo/gofort/actions/workflows/ci.yml)
Yet another [`fortune`](https://wiki.archlinux.org/title/Fortune) clone, written in Go.
Besides that, what's different here?
1. Uses simple text files. No effort has been done to re-implement parsing the strfiles as in original fortune and some other clones.
2. Uses a streaming approach combined with reservoir sampling instead of reading whole files into memory first.
3. Self-contained binary, only using the standard library. Fortune files are bundled via `go:embed`.
> **tl;dr:** simple, efficient and self-contained.
## Bootstrapping
Just some ideas where you could use this.
### initramfs
Hook it into [intramfs](https://wiki.archlinux.org/title/mkinitcpio) when you're feeling extra lucky.
Take a look [at this repository](https://github.com/kdevo/mkinitcpio-asciilogo).
### Bash
```sh
echo "~/path/to/gofort" >> ~/.bashrc
```
### Zsh
```sh
echo "~/path/to/gofort" >> ~/.zshrc
```
### motd
The motd setup is distro-specific:
- On Debian and Ubuntu, the [`update-motd` mechanism can be used](https://wiki.ubuntu.com/UpdateMotd) with a script that launches motd.
- On Arch, it's a bit more complicated:
- One way to do it is described [in this repo](https://github.com/lfelipe1501/Arch-MOTD/wiki/Installation-Guide) (replace the `update_motd.sh` with 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/motd` with a fortune by executing gofort.