14 hours ago · Tech · hide · 0 comments

The IDs for posts on this site are generated by using base32b32 encoding to convert timestamps into strings of text. The idea being to get shorter IDs that still sort in chronological order. For example, this timestamp: 2026-07-20T13:27:00-04:00 Turns into this snippet: 01n5wpk4 It works great, as long as you do the encoding properly. It turns out, Dear Reader, that I did not do it properly. This is the process I wrote to fix them. It does two things: update the ids in the files based of the created timestamp. generates blog folders for the new IDs. Rust ./Cargo.toml[package] name = "base32_timestamp_cleanup" version = "0.1.0" edition = "2024" [dependencies] anyhow = "1.0.104" base32 = "0.5.1" chrono = "0.4.45" regex = "1.13.1" walkdir = "2.5.0" ./src/main.rsuse anyhow::Result; use base32::Alphabet; use chrono::{DateTime, FixedOffset}; use regex::Regex; use std::{fs, path::PathBuf}; use walkdir::WalkDir; fn main() -> Result<()> { update_file_ids()?; make_blog_folders()?;…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.