resist is a command-line tool that reads from stdin and redirects the input to one of several file descriptors based on provided conductances. The likelihood of a file descriptor being chosen is proportional to its conductance.
If you are using Nix you can run resist without installing it:
nix run github:nilp0inter/resist
To compile resist, you will need Rust's package manager, Cargo. Ensure you have Rust and Cargo installed on your system.
- Clone the repository:on
git clone https://github.com/nilp0inter/resist.git
cd resist
- Compile the project:
cargo build --release
The compiled binary will be located at target/release/resist
.
After compiling resist, you can install it on your system.
- Copy the binary to a location in your PATH, such as
/usr/local/bin/
:
cp target/release/resist /usr/local/bin/
- (Optional) Copy the man page to your man pages directory (e.g.,
/usr/local/man/man1/
) and update the man database:
cp resist.1 /usr/local/man/man1/
mandb
resist takes conductance values as arguments, each corresponding to a file descriptor starting from 1 (stdout). Higher conductance values increase the probability of a file descriptor being chosen for output.
To redirect input with conductances 30, 15, and 2 to three different files (file1.txt, file2.txt, and file3.txt), using file descriptors 1 (stdout), 2 (stderr), and 3, respectively:
resist 30 15 2 1>file1.txt 2>file2.txt 3>file3.txt