]> git.scottworley.com Git - keystroke-timestamps/commitdiff
Include the `fill-in` helper script here master
authorScott Worley <scottworley@scottworley.com>
Sat, 22 Aug 2026 16:09:47 +0000 (09:09 -0700)
committerScott Worley <scottworley@scottworley.com>
Sat, 22 Aug 2026 16:41:47 +0000 (09:41 -0700)
Changelog
fill-in.sh [new file with mode: 0755]
plot.gnuplot

index ca9fbbd48919b5741ca0d6b779ec3b7dcebe93e5..a2ed5020fd85ec492dbe65a51e81fcdf2cc019fe 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,7 @@
 ## [Unreleased]
 - More portable shebangs
 - Demo daily-gaps.sh script
 ## [Unreleased]
 - More portable shebangs
 - Demo daily-gaps.sh script
+- Include the `fill-in` helper script here
 
 
 ## [1.1.0] - 2026-08-21
 
 
 ## [1.1.0] - 2026-08-21
diff --git a/fill-in.sh b/fill-in.sh
new file mode 100755 (executable)
index 0000000..7e781cc
--- /dev/null
@@ -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
index 47b078051e9e5e3de7e0149d7265b32b77eca11a..c8329c4a2c0d2f23198e35c5597a0d9291e7e57f 100755 (executable)
@@ -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 ".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"
 
 pause -1 "Press enter to dismiss"