Created
March 10, 2016 22:10
-
-
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
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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demo: http://img.chartio.com/2F0Q2E1V1Y2d