From: Scott Worley Date: Sat, 22 Aug 2026 16:09:47 +0000 (-0700) Subject: Include the `fill-in` helper script here X-Git-Url: http://git.scottworley.com/keystroke-timestamps/commitdiff_plain/refs/heads/master Include the `fill-in` helper script here --- diff --git a/Changelog b/Changelog index ca9fbbd..a2ed502 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ ## [Unreleased] - More portable shebangs - Demo daily-gaps.sh script +- Include the `fill-in` helper script here ## [1.1.0] - 2026-08-21 diff --git a/fill-in.sh b/fill-in.sh new file mode 100755 index 0000000..7e781cc --- /dev/null +++ b/fill-in.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Add zeros to epoch-timestamped streams. For example, with interval=100: +# +# Input: +# 10000400 3 +# 10000500 4 +# 10000800 2 +# +# Output: +# 10000400 3 +# 10000500 4 +# 10000600 0 +# 10000700 0 +# 10000800 2 +# +# This is helpful for feeding such streams to gnuplot. + +interval=${1:-3600} +zero=${2:-0} + +read -r prevt rest +echo "$prevt $rest" +while read -r t rest;do + while (( t - prevt > interval ));do + prevt=$(( prevt + interval)) + echo "$prevt $zero" + done + echo "$t $rest" + prevt=$t +done diff --git a/plot.gnuplot b/plot.gnuplot index 47b0780..c8329c4 100755 --- a/plot.gnuplot +++ b/plot.gnuplot @@ -16,6 +16,6 @@ plot "< awk '{ print int($1 / ".bucket_size.") }' \"".filename."\" \ | fill-in ".bucket_size \ using ($1 + timezone_offset):2 with lines -# (fill-in is https://chkno.net/fill-in ) +# (fill-in is ./fill-in.sh) pause -1 "Press enter to dismiss"