Blog: 2026-05-02

From razwiki
Jump to navigation Jump to search
    set -U mid_time $last_time
    set -U last_time $now_time
    set -U now_time (gdate +%s.%3N)

    set diff (math $now_time - $last_time)
    set diff2 (math $last_time - $mid_time)
    set avg (math "($diff + $diff2) / 2")
    set bps (math 1 / $avg)
    set bpm (math "$bps * 60")
    # echo -n $mid_time $last_time $now_time
    if test $bpm -gt 55
        echo -n "$bpm "
    end

bpm counter in the terminal. Might end up popping up when I don't want it. Also it's a naive 3-value diff average, doesn't stop if there's a break