Skip to content

Instantly share code, notes, and snippets.

@kbinani
Last active August 29, 2015 14:16
Show Gist options
  • Save kbinani/05d45686e57de7229879 to your computer and use it in GitHub Desktop.
Save kbinani/05d45686e57de7229879 to your computer and use it in GitHub Desktop.
autoincense.haka.yamashi.ro.cron
0 0 * * * API_TOKEN="xxxx"; HOUR_FROM=11; HOUR_TO=22; function get_rand { local FROM=$1; local TO=$2; local DIFF=$(echo "$TO - $FROM" | bc); echo "$FROM + $DIFF * $(echo "ibase=16; $(openssl rand -hex 2 | tr a-f A-F)" | bc) / 65535" | bc; }; echo "sleep $(get_rand 0 59) >/dev/null 2>&1; curl -d token=$API_TOKEN http://haka.yamashi.ro/api/v1/incenses >/dev/null 2>&1" | at $(printf "\%02d:\%02d" $(get_rand $HOUR_FROM $HOUR_TO) $(get_rand 0 59)) >/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment