https://github.com/macie/sortof
Peculiar sorting tools
https://github.com/macie/sortof
bogosort cli slowsort stalinsort
Last synced: 5 months ago
JSON representation
Peculiar sorting tools
- Host: GitHub
- URL: https://github.com/macie/sortof
- Owner: macie
- License: mit
- Created: 2023-08-21T20:30:16.000Z (almost 3 years ago)
- Default Branch: dev
- Last Pushed: 2025-06-15T09:13:36.000Z (about 1 year ago)
- Last Synced: 2025-06-15T09:44:08.564Z (about 1 year ago)
- Topics: bogosort, cli, slowsort, stalinsort
- Language: Go
- Homepage:
- Size: 130 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sortof
[](https://pkg.go.dev/github.com/macie/sortof)
[](https://www.bestpractices.dev/projects/8153)
[](https://github.com/macie/sortof/actions/workflows/check.yml)
[](https://goreportcard.com/report/github.com/macie/sortof)
**sortof** provides implementations of ~~peculiar~~ _carefully selected_ sorting algorithms as a:
- CLI tool for sorting input, line by line (similar to _[POSIX sort](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html)_),
- Go module with functions for sorting slices (similar to _[slices.Sort()](https://pkg.go.dev/slices#Sort)_).
Implemented algorithms:
- impractical due to poor time complexity:
- [bogosort](https://en.wikipedia.org/wiki/Bogosort)
- [miraclesort](https://en.wikipedia.org/wiki/Bogosort#miracle_sort)
- [slowsort](https://en.wikipedia.org/wiki/Slowsort)
- impractical due to destructive behavior:
- [stalinsort](https://mastodon.social/@mathew/100958177234287431)
## Usage
```sh
$ cat letters.txt
c
a
b
$ sortof bogo -t 10s letters.txt
a
b
c
```
## Installation
Download the [latest stable release from GitHub](https://github.com/macie/sortof/releases/latest).
You can also build it manually with: `make && make build`.
## Development
For detailed contribution guidelines, see [CONTRIBUTING.md](./CONTRIBUTING.md).
Use `make` (GNU or BSD):
- `make` - install dependencies
- `make test` - run tests
- `make e2e` - run end-to-end tests for CLI
- `make check` - run static code analysis
- `make build` - compile binaries from latest commit
- `make dist` - compile binaries from latest commit for supported OSes
- `make clean` - remove compilation artifacts
- `make cli-release` - tag latest commit as a new release of CLI
- `make module-release` - tag latest commit as a new release of Go module
- `make info` - print system info (useful for debugging).
### Versioning
This repository contains both a CLI and Go module which can be developed at different paces.
Commits with versions are tagged with:
- `vX.X.X` (_[semantic versioning](https://semver.org/)_) - versions of Go module
- `cli/vYYYY.0M.MICRO` (_[calendar versioning](https://calver.org/)_) - versions of command-line utility.
### Security hardening
On modern Linux distributions and OpenBSD, the CLI application has restricted access to kernel
calls with [seccomp](https://en.wikipedia.org/wiki/Seccomp) and [pledge](https://man.openbsd.org/pledge.2).
## License
[MIT](./LICENSE)