typr.sh
typr.sh
is a typing test for your terminal
Try it out by downloading typr or running it directly (at ur own risk):
sh -c "$(curl https://davidovski.xyz/typr.sh)"
I decided to try and write an interactive program purely in POSIX shell, so I decided to try and create a game like
monkeytype but for the terminal. It currently has two test modes, words and time: testing how long it takes for you to type a given amount of words and testing how many words you can type in a given amount of time respectively. You can see the options by doing
typr.sh -h
When i say pure POSIX shell, I mean as pure as it can get: no bashisms or gnu flags (asterix here) while avoiding forking to other programs like the plague. Some features I took as shell "builtins", being ones that are builtin to
dash
, so printf was used quite heavily.
The only exceptions to the no forking rule are using
stty
to configure the terminal (though there could be other ways to do this) and
date
to get accurate time. While I did use the GNU "%N" feature of date to get the time in nanoseconds, this is entirely optional and the program should work without this, though will suffer from slightly less precision.
Instead of using ncurses (tput) I decided to just embed all of the escape sequences directly in the strings printed. This might make it a bit difficult to open the script in some editors, but it means that there is one less dependency, so hopefully it will run on most places easier.
I've not tested it on many machines, but I'm curious to see how well it works on different configurations, so please try it out and tell me how it works. (contact info on index.html).
ignore me typing really slowly here this is just a test. I can type much faster than that, promise