Skip to content

Instantly share code, notes, and snippets.

@frafra
Last active December 26, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frafra/7107667 to your computer and use it in GitHub Desktop.
Save frafra/7107667 to your computer and use it in GitHub Desktop.
Calculate interval between two clicks
#!/bin/bash
DEV="/dev/input/mouse0"
SEQ="ht nul nul"
function click_event {
stdbuf -oL od -w3 -t a -A n "$DEV" | grep -m1 "$SEQ" > /dev/null
}
click_event
start=$(date +%s.%N)
click_event
stop=$(date +%s.%N)
echo $stop-$start | bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment