Skip to content

Instantly share code, notes, and snippets.

@benekastah
Created March 10, 2016 22:10
Show Gist options
  • Save benekastah/9992a0419bdc7672c3c2 to your computer and use it in GitHub Desktop.
Save benekastah/9992a0419bdc7672c3c2 to your computer and use it in GitHub Desktop.
Be such productive while you type as fast and loud as you want
#!/bin/bash
await-key () {
tput smso
tput rmso
oldstty=`stty -g`
stty -icanon -echo min 1 time 0
dd bs=1 count=1 >/dev/null 2>&1
stty "$oldstty"
}
select-random () {
txt="$@"
if [ -z "$txt" ]; then
txt="`cat`"
fi
echo "$txt" | sort -R | head -n1
}
dir="/usr/include"
files="$(find $dir -type f -name '*.h' -print | sed 's/\s+/\n/g')"
while :; do
await-key
# Echo random line from random header file
cat "$(select-random "$files")" | select-random
done
@benekastah
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment