Created
April 16, 2017 19:21
-
-
Save thbkrkr/3512561b5f4e62149d7e9ad0bc8d6b5a to your computer and use it in GitHub Desktop.
blink stick on pingpong kafka message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -eu | |
| # | |
| # Toggle 2 LED on each kafka message. | |
| # @dep jq, oq (https://github.com/thbkrkr/qli/releases/download/0.2.1/oq), blinkstick (pip install blinkstick) | |
| # | |
| get() { jq -r .message <<< $1 2>/dev/null; } | |
| blink() { blinkstick --index $1 --pulse $2 --brightness 40 --duration 70; } | |
| while read msg; do | |
| msg=$(get $msg) | |
| echo "$msg" | |
| case "$msg" in | |
| ping) blink 1 cyan & ;; | |
| pong) blink 6 green & ;; | |
| esac | |
| done < <(oq -t thbkrkr.pingpong) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment