Simple TUI for typing tests
Find a file
2022-02-12 22:47:26 +01:00
.github/ISSUE_TEMPLATE Update issue templates 2021-07-11 20:26:42 +02:00
doc example updated 2022-02-03 14:01:03 +01:00
fasttyper added executable 2022-02-12 22:45:26 +01:00
.gitignore Initial commit 2021-07-10 16:42:22 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2021-07-11 20:27:59 +02:00
LICENSE Initial commit 2021-07-10 16:42:22 +02:00
Makefile makefile 2022-02-03 14:21:18 +01:00
README.md added executable 2022-02-12 22:45:26 +01:00
setup.cfg 1.6.0 2022-02-12 22:47:26 +01:00
setup.py 1.6.0 2022-02-12 22:47:26 +01:00

fasttyper

About

Fasttyper is minimalistic typing test based on user provided exercising text. It supports both reading from text files and stdin supporting wide range of usecases. The goal was to create it as simple as it can be, without any additional bloatware functionalities. That means that Fasttyper doesn't come with build in test generator and you have to provide your own scripts generating tests. Some examples of such scrips are providen in Usage section.

Installation

Fasttyper is currently maintained on PyPi Python Package Index. To install package simpply use:

python3 -m pip install fasttyper

Usage

With installation of fasttyper you should have new executable - fasttyper. It takes two optional positional arguments, amount of words and language (like in monkeytype: english, english_1k etc).

Avalibe options:

usage: fasttyper [-h] [--config FILE] [--unclutter-backspace] [--no-cursor] [amount] [language]

positional arguments:
  amount                Amount of words
  language              Language

options:
  -h, --help            show this help message and exit
  --config FILE, -c FILE
                        configuration file
  --unclutter-backspace, -b
                        unclutter backspace, when it raises ctrl+backspace instead
  --no-cursor, -n       disable cursos

I personally use alias:

alias ff='fasttyper -n`

because i don't like having cursor.

Usage as module, piping stuff, custom scripts etc

Fasttyper is ran as an python module, so to execute it simply type:

python3 -m fasttyper

from cloned github repository, if you didn't install package from TestPyPi.

Fasttyper can open text files, which path should be provided as first and only argument to the module execution, for example:

python3 -m fasttyper example_text.txt

Program also allows user to pipe text into it. Keep in mind, it only supports spaces and new line characters, so you won't be able to table tabs. For example, you can run Fasttyper on fortune generated quote changing tabulators to spaces with sed:

furtune | python3 -m fasttyper

or if you want to randomize words from given file with shuf on for example all disctionaries in system:

shuf -n5 /usr/share/dict/* | python -m fasttyper

You can use another similar projects set of words as well, for example to create test with 20 random words from Monkeytype's english 100 dictionary use:

curl -s https://raw.githubusercontent.com/Miodec/monkeytype/master/static/languages/english.json | python3 -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))" | shuf -n20 | python3 -m fasttyper

To exit you can either finish test, use KeyboardInterrupt (CTRL+C) or tap tab then enter. After you finish test, there will be summary printed, use enter to exit from it.

When backspace does wierd shiet

Some terminal emulators send different values for key presses of backspace and ctrl+backspace. To fix it, simply add b flag like that: python3 -m fasttyper -b.

Hiding cursor

To hide the cursor, simply add n flag like that: python3 -m fasttyper -n.

Example scripts

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 || break
	done
}

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 exit from it if you exit fasttyper with CTRL+C.

The above script is avalible for download from doc folder.