fasttyper/README.md

65 lines
3.1 KiB
Markdown
Raw Normal View History

2021-07-10 16:42:22 +02:00
# fasttyper
2021-09-07 13:23:13 +02:00
[![](https://github.com/ickyicky/fasttyper/blob/main/doc/fasttyper.gif?raw=true)](https://github.com/ickyicky/fasttyper)
2021-07-10 17:09:59 +02:00
# About
2021-07-11 12:57:03 +02:00
_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](#usage).
2021-07-10 17:09:59 +02:00
# Installation
2022-02-10 17:00:30 +01:00
_Fasttyper_ is currently maintained on [PyPi](https://pypi.org/) Python Package Index. To install package simpply use:
2021-07-23 14:54:10 +02:00
`python3 -m pip install fasttyper`
2021-07-10 17:09:59 +02:00
# Usage
_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](#installation) package from TestPyPi.
_Fasttyper_ can open text files, which path should be provided as first and only argument to the module execution, for example:
2021-07-10 17:09:59 +02:00
`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:
2021-07-10 17:09:59 +02:00
`furtune | python3 -m fasttyper`
2021-07-10 17:09:59 +02:00
or if you want to randomize words from given file with shuf on for example all disctionaries in system:
2021-07-11 02:34:53 +02:00
`shuf -n5 /usr/share/dict/* | python -m fasttyper`
2021-07-11 02:34:53 +02:00
2021-07-11 12:57:03 +02:00
You can use another similar projects set of words as well, for example to create test with 20 random words from [Monkeytype's](https://github.com/Miodec/monkeytype) 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`
2021-07-11 12:57:03 +02:00
2022-02-03 14:20:16 +01:00
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.
2021-07-23 14:30:46 +02:00
2022-02-10 16:45:10 +01:00
# 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 to `python3 -m fasttyper`.
2021-07-23 14:30:46 +02:00
## Example scripts
2021-07-23 14:36:24 +02:00
```sh
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
2022-02-03 13:49:08 +01:00
while true
do
2022-02-03 14:01:03 +01:00
shuf -n $amount $sfile | python3 -m fasttyper || break
2022-02-03 13:49:08 +01:00
done
2021-07-23 14:36:24 +02:00
}
2021-07-23 14:30:46 +02:00
```
`ff 50 english_1k`
2021-07-23 14:36:24 +02:00
2022-02-03 14:01:03 +01:00
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.
2022-02-03 13:50:58 +01:00
The above script is avalible for download from doc folder.