From 3dd5d0a8fc5e45a7632b57b7aacb8b1fac7a0ae4 Mon Sep 17 00:00:00 2001 From: Doman Date: Thu, 3 Feb 2022 13:50:58 +0100 Subject: [PATCH] bump example added to doc for download --- README.md | 2 ++ doc/fasttyper.sh | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 doc/fasttyper.sh diff --git a/README.md b/README.md index cd8cb1a..dae7698 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,5 @@ function ff() { `ff 50 english_1k` This shell function shuffles N words from cached word list, and if given word list doesnt exist it download's it. It runs in loop, but does sleep 1s after each taken test (or interrupted!) so to exit loop just use CTRL+C twice: once to exit fasttyper, second time to exit loop on sleep. + +The above script is avalible for download from doc folder. diff --git a/doc/fasttyper.sh b/doc/fasttyper.sh new file mode 100644 index 0000000..ff6e5f4 --- /dev/null +++ b/doc/fasttyper.sh @@ -0,0 +1,14 @@ +# fasttyper +function ff() { + mkdir -p ~/.cache/fasttyper + local amount="${1:-50}" + local language="${2:-english}" + local sfile=~/.cache/fasttyper/$language + local source_path=https://raw.githubusercontent.com/Miodec/monkeytype/master/static/languages/$language.json + [[ ! -f $sfile ]] && curl -s $source_path | python3 -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))" > $sfile + while true + do + shuf -n $amount $sfile | python3 -m fasttyper + sleep 1 + done +}