Skip to content

Instantly share code, notes, and snippets.

@rgruesbeck
Last active November 13, 2018 00:53
Show Gist options
  • Save rgruesbeck/4cb042dabe7d2ecda10590dfba9516f4 to your computer and use it in GitHub Desktop.
Save rgruesbeck/4cb042dabe7d2ecda10590dfba9516f4 to your computer and use it in GitHub Desktop.
get random strings from your mic
#!/usr/bin/env bash
clip() {
# sync clipboards
xclip -o | xclip -sel clip
# print to stdout
xclip -o
}
audioSource() {
# record 1 second of audio
arecord -d 1 /tmp/rand.wav
}
hmac() {
# hmac of audio with random key -> base64 32
hmac256 --binary $(openssl rand --base64 32) /tmp/rand.wav | base64 | cut -c 1-32 | xclip
}
clean() {
# cleanup
rm /tmp/rand.wav
}
main() {
audioSource
hmac
clip
clean
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment