git.y1.nz

typie

Minimal typing practice tool.
download: https://git.y1.nz/archives/typie.tar.gz
README | Files | Log | Refs | LICENSE

examples/lesson.sh

      1 #!/bin/sh
      2 
      3 # proof-of-concept for what a basic typing lesson might look like.
      4 # Usage: ./lesson.sh OLD_LETTERS NEW_LETTERS
      5 
      6 set -e
      7 
      8 OLD_LETTERS=$1
      9 NEW_LETTERS=$2
     10 
     11 cat dvorak
     12 
     13 old_letters() {
     14 	echo "$OLD_LETTERS" | fold -b -w 1 | shuf -n $1 | tr -d '\n'
     15 }
     16 
     17 OLD_LETTER_COUNT="$(echo "$OLD_LETTERS" | wc -c)"
     18 EASY=$(($OLD_LETTER_COUNT / 4))
     19 MEDIUM=$((2 * $OLD_LETTER_COUNT / 4))
     20 HARD=$((3 * $OLD_LETTER_COUNT / 4))
     21 
     22 echo "You already know: [$OLD_LETTERS] and will learn [$NEW_LETTERS]."
     23 echo "If it gets too hard, don't be afraid to ctrl+C and redo previous lessons."
     24 echo ""
     25 
     26 echo "Introducing the new letters..."
     27 typie -lo /dev/null "$(./words-by-letter.sh "$NEW_LETTERS" 6 12)"
     28 typie -lo /dev/null "$(./words-by-letter.sh "$NEW_LETTERS" 6 12)"
     29 
     30 echo "Integrating with some old letters..."
     31 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)"
     32 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)"
     33 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)"
     34 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $MEDIUM)$NEW_LETTERS" 5 8)"
     35 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $MEDIUM)$NEW_LETTERS" 5 8)"
     36 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $HARD)$NEW_LETTERS" 5 8)"
     37 typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $HARD)$NEW_LETTERS" 5 8)"
     38 
     39 echo "All together now!"
     40 typie -o /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)"
     41 typie -o /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)"
     42 typie -o /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)"
     43 
     44 echo "All done! :3"

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.