rot/README.md
2026-01-15 10:40:19 -08:00

52 lines
1.8 KiB
Markdown

# poem, rotting
This is a small program that slowly rots a given text file. It replaces random
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
Download binary: [macOS](https://git.tilde.town/ike/rot/releases/download/0.1/rot-darwin), [linux_amd64](https://git.tilde.town/ike/rot/releases/download/0.1/rot-linux_amd64)
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 .
```