Skip to content

Instantly share code, notes, and snippets.

@blkirk
blkirk / timed
Created May 23, 2026 22:28
Profiling for scripts/cli/etc.
#!/usr/bin/env bash
# Reads stdin line-by-line and prefixes each line with elapsed time
# since the previous line in MM:SS format.
last_time=$(date +%s)
while IFS= read -r line; do
now=$(date +%s)
elapsed=$((now - last_time))