godsays 0.1.0

Rust port of the programmer Terry Davis' (RIP) "god says" program
Documentation

terry

RIP Terry A. Davis 1969-2018

god says

Rust port of the programmer Terry Davis' "god says" (AKA GodSpeaks) program.


Terrence Andrew Davis (December 15, 1969 – August 11, 2018) was an American programmer who created and designed the operating system TempleOS alone. It was a highly complex and unusual undertaking for one person, as the project extended to building core components such as programming language, editor, compiler and kernel virtually from scratch. Davis also posted video blogs to social media, and by the time of his death, had amassed a small online following. He often referred to himself as "the smartest programmer that's ever lived". From Wikipedia.

About TempleOS, from his own words:

TempleOS is God's official temple. Just like Solomon's temple, this is a community focal point where offerings are made and God's oracle is consulted.

Contained in Terry's TempleOS masterpiece were various random text generators. Terry believed that by generating this text one could "speak to God". Through making random associations in the text, much like a Rorschach ink-blot test.

For that purpose, he designed a random number generator called god, and used it in TempleOS to generate text.

The original source of this program can be found here.

Besides the original program which was written in HolyC, he was using a bash script to generate text:

#!/bin/bash
# This prints random words.
echo "$(gshuf -n 32 ./Happy.TXT --random-source=/dev/urandom | tr '\n' ' ')"

So I reproduced this logic in Rust and created a simple CLI program (godsays) and a webserver (godsays-server) for extended use-cases (and tribute to TAD).

Please note that some of the words may be offensive - I am merely using Terry's original wordlist and thus cannot be held responsible for any of the views expounded by God in the generated text. The only modification that has been made to Terry's text is the replacement of underscores with spaces.

Installation

Usage

CLI

godsays command line tool simply selects 32 random words from Happy.TXT and prints them out.

cargo run

output:

sloth special case I'll ask nicely incredibly in a galaxy far far away what do you want I'm done slumin oh no the enquirer really by the way that's for me to know Isn't that special don't mention it baffling furious I'll think about it Han shot first downer unsung hero super computer horrendous ahh who's to say You da man I give up cosmetics it'd take a miracle stuff holy grail I'll be back

* Use of the --release flag embeds the Happy.TXT into the binary.

Docker

Pull the latest image from Docker Hub and run the container:

docker pull orhunp/godsays
docker run -t orhunp/godsays

Or do it manually:

docker build -f docker/cli/Dockerfile -t godsays .
docker run -t godsays

Server

godsays-server is a simple HTTP server with the same purpose of godsays. It returns the randomly generated text on a GET / request. (Use GET /json for JSON output)

curl https://godsays.xyz

output:

ba ha you know a better God do not disturb its trivial obviously ho ho ho failure to communicate if anything can go wrong do you like it in a perfect world that's all folks eh Mission Accomplished super computer Trump kick back vice liberal gosh baffling I'm in suspense holier than thou frown in a galaxy far far away in practice China tree hugger scum snap out of it I'm on a roll joyful money what's it to you

to run locally:

cargo run --features server --bin godsays-server

* A fun use case is creating a git alias as follows:

git config --global alias.godsays '!git commit -m "$(curl -s https://godsays.xyz)"'

Docker

Pull the latest image from Docker Hub and run the container:

docker pull orhunp/godsays-server

Or do it manually:

docker build -f docker/server/Dockerfile -t godsays-server .
docker run --rm -e "ADDR=0.0.0.0:3000" -dp 3030:3000 godsays-server

See also

License

The MIT License

Copyright

Copyright © 2021, Orhun Parmaksız