kilork.github.io

Projects

A terminal running keycloak-cli report, with a bar chart of users and events

Things I built because the existing tool either did not exist or did not survive contact with a real system. Each one says what changes for you if you use it, not what it contains. If a page is linked, it has a longer note.

Static assets and web

static-files

Bundle a directory of static files into your Rust binary.

Point build.rs at static/ and the files become Rust data compiled into the executable: one binary to ship, no assets directory next to it, no path to configure in production. It can run your npm/yarn build on the way, and it only re-bundles when the inputs actually changed.

For Rust services that ship a frontend.

cargo add static-files

actix-web-static-files

Serve those embedded files from actix-web.

One service, ResourceFiles::new("/", generate()), and every bundled file is served from memory with the right content type — no filesystem lookup on the request path. Routes that are not files fall back to index.html, which is what Angular-style routers need.

For actix-web 4 services with a web UI.

cargo add actix-web-static-files --features static-files-03

pdf2

Read, inspect and draw PDF 2.0 files in pure Rust.

One crate and one document model: open a file, see exactly what it contains, extract its text and (with the sibling crate) draw the page — no C library, no unsafe, and the same code builds for no_std and wasm. Every malformed file is an error, never a panic, and a decompression bomb is refused by a byte budget instead of eating the process.

For Rust services that have to touch PDFs, and nowhere to put a C engine.

cargo install pdf2-cli

Keycloak and identity

keycloak-cli

Every Keycloak admin operation as a command, generated from the crate.

No more curl with a token you fetched by hand. Log in once per terminal and the password stays there; TAB completes your realms, users, groups and clients; output is a table, JSON, YAML, markdown or HTML; `--dry-run` shows the request before anything happens and deletes need `--yes`.

For anyone scripting Keycloak instead of clicking through the admin console.

curl -fsSL https://raw.githubusercontent.com/rust-utility/keycloak-cli/main/install.sh | sh

keycloak

The Keycloak Admin API as typed Rust.

All 415 admin operations, generated from Keycloak's own description for the release you pin, so the client cannot quietly fall behind the server. Turn on only the resource groups you use and the rest never compiles.

For Rust services that administer realms, users, clients and roles.

cargo add keycloak

openid

Log users in with any OpenID provider, without adopting a web framework.

Discovery, the authorization-code flow with PKCE, token validation against the provider's keys and userinfo — functions you call from the handlers you already have. Google, Keycloak, Azure AD and Okta all work the same way.

For Rust services that need real login.

cargo add openid

Recovery and forensics

xfs-doctor

Read-only rescue tools for XFS images that will not mount.

Inspect headers at any offset, work out a RAID0 half-image's geometry, salvage directories without mounting anything, and carve files by signature when the metadata is gone. It never writes to the image and does not need the array.

For anyone with a NAS that stopped mounting and data they still want.

cargo install xfs-doctor

hg-git-fast-import

Move Mercurial history into Git, including the awkward parts.

One Mercurial repository or many into a single Git repository, through fast-import, keeping tags and closed branches. Re-run it to pick up new revisions, and check the result with a diff before you trust it.

For people leaving Mercurial without leaving their history behind.

cargo install hg-git-fast-import

Everyday tools

git-site-clone

Paste a repo URL and it lands where you keep code.

Configure a base directory once, and `git-site-clone https://github.com/user/repo` checks out into `base/github.com/user/repo` — no mkdir dance. Mappings let a host point somewhere else, and it can take the URL from the clipboard.

For people with a tidy ~/src tree and no patience for manual clones.

cargo install git-site-clone

handlebars-magic

One folder of handlebars templates, one rendered folder.

Documentation, reports and configs from the same data: each template in the input directory produces the matching file in the output directory, with the usual handlebars helpers.

For people who generate files instead of editing them.

cargo install handlebars-magic

dm-mono-nerd-font

DM Mono with the glyphs your terminal expects.

Nerd Font icons, Cyrillic, arrows and box drawing, all at the same width, so prompt themes and file managers stop rendering boxes. Ships as release archives and a Homebrew tap.

For people who like DM Mono and live in a terminal.

brew install --cask kilork/dm-mono-nerd-font/dm-mono-nerd-font

Rust building blocks

path-matchers

Glob and path matching you can combine.

One small trait over plain paths and glob expressions, so your code filters paths without growing its own matcher — and two matchers can be combined.

For library authors who keep writing path filtering.

cargo add path-matchers

change-detection

Tell Cargo exactly what your build script depends on.

Generates the rerun-if-changed instructions for your static inputs, so a build re-runs when something actually changed and stays incremental when nothing did.

For build tooling and anything with a build script.

cargo add change-detection

cmake-parser

Read CMakeLists.txt as data.

Parses CMake files (language 3.26) into structures you can inspect and transform, instead of pulling your hair out with regular expressions.

For tools that read or migrate C and C++ builds.

cargo add cmake-parser

rust-libxml

Use libxml2 from Rust when exact behaviour matters.

Wraps libxml2 without hiding it: Rust ownership, automatic deallocation, and the parser behaviour your documents were already written against.

For Rust programs that cannot afford a different XML parser.