Skip to content

Instantly share code, notes, and snippets.

View jayenashar's full-sized avatar
🏚️
Working from home

Jayen Ashar jayenashar

🏚️
Working from home
View GitHub Profile
@jayenashar
jayenashar / throttle.sh
Created October 28, 2022 23:26
throttle in bash
#!/bin/bash
# usage: throttle.sh FILENAME THROTTLE_SECONDS CMD [ARGS...]
# example usage: while sleep .1; do throttle.sh /tmp/date 1 date +%s.%N; done
FILENAME=$1
THROTTLE_SECONDS=$2
shift 2
last_called=$(<$FILENAME)