diff --git a/README.md b/README.md index 28f4d05..d1b6285 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,45 @@ characters with other unicode characters, and sometimes deletes characters and sends them off into the internet over UDP ECHO packets. This program is used in a poetry project that lives here: [tilde.town/~ike/rot.html](https://tilde.town/~ike/rot.html) + +## Usage + +Before using this program, you need to have a poem file ready. This is a plain text file. + +To use this program in production, run the binary with the the first parameter as the poem file, and the second parameter as the html file to update. For example: + +``` +$ rot ~/poem.txt /var/www/rot.html +``` + +To use this program in development, you can run it with `go run`: + +``` +$ go run main.go poem.txt test.html +``` + +Every time this program runs, it will take the contents of the poem file, "rot" +it using its algorithm, write the contents to the html file, and then update the +poem file with the new rotted contents. + +One way to automate this is to use a [cron job](https://crontab.guru/) that runs +on a regular interval, for example, every hour: + +``` +0 * * * * /path/to/rot /path/to/poem.txt /path/to/rot.html +``` + +## Development + +To build the program, make sure you have [Go](https://golang.org/dl/) installed. +These instructions assume you have Go 1.24 or later, and are running on macOS. + +Then, clone this repository and run: +``` +$ go build -o dist/rot-darwin . +``` + +To build for linux, run: +``` +$ CC=x86_64-unknown-linux-gnu-gcc CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -ldflags '-linkmode external -w -extldflags "-static"' -o dist/rot-linux_amd64 . +``` diff --git a/dist/rot-darwin b/dist/rot-darwin index c062f36..eb7944c 100755 Binary files a/dist/rot-darwin and b/dist/rot-darwin differ