git home / emma home
logo

typie

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

commit 0069fec3f48441e3299947edec1a65d3ed19137d
parent e8bbe90094ec128b340f2a261f5c2567ee2fe11d
Author: Emma Weaver <emma@waeaves.com>
Date:   Sun, 10 May 2026 13:05:27 -0400

Updated scripts, switched file input flag to -o

Diffstat:
MREADME4++--
Mexamples/README35++++++++++++++++++++++++++---------
Rexamples/dicts/20k.txt -> examples/dict.txt0
Dexamples/dicts/1k.txt1024-------------------------------------------------------------------------------
Dexamples/dicts/2k.txt2048-------------------------------------------------------------------------------
Aexamples/doubles.sh26++++++++++++++++++++++++++
Mexamples/learn.sh17++++++++++-------
Mexamples/lesson.sh24++++++++++++------------
Mexamples/practice.sh12+++---------
Mexamples/words-by-letter.sh39++++++++++++++++++++++++++-------------
Mmain.c12++++++------
Mopt.c2+-
Mtyper.c21++++++++++++---------
Mtypie.14++--
14 files changed, 126 insertions(+), 3142 deletions(-)

diff --git a/README b/README @@ -2,7 +2,7 @@ Typie -------------------------------------------------------------------------------- This is a minimal program for practicing typing in the command line. See -examples for some intended use cases. +the examples directory for some of the use cases I have for this. Features: - minimal, only C and standard libs, short and clean code @@ -27,4 +27,4 @@ To install it, edit config.mk to reflect your system's configuration, then run # TODO -------------------------------------------------------------------------------- - output data about mistakes (for learning layouts) - + - switch to using clock_t for timing diff --git a/examples/README b/examples/README @@ -1,12 +1,29 @@ - ............ - . Examples . - ............ +|| +|| Example Scripts +|| - They're kind of done poorly, because I'm sorta bad at shell - scripting. But, in order of their usefulness: +They're kind of done poorly, because I'm sorta bad at shell scripting. But, +in order of their usefulness: - learn.sh: for learning new keyboard layouts. I made this while learning - the dvorak keyboard so it's mostly made for that use case and - little else. +learn.sh +| for learning new keyboard layouts. I made this while learning the +| dvorak keyboard so it's configured for that use case and little else. - practice.sh: basically a command-line monkeytype replacement :) +practice.sh +| prompts the user to type a 50-word prompt. The version I use (see my +| dotfiles repo) writes my results to a timestamped file. + +doubles.sh +| prompts the user for a word length, then drills the user on a series of +| words with that length by having them type each one a few times. + +words.sh COUNT +| outputs COUNT words. + +--- + +Utility scripts (mostly used by learn.sh): + +lesson.sh +words-by-letters.sh +letters.sh diff --git a/examples/dicts/20k.txt b/examples/dict.txt diff --git a/examples/dicts/1k.txt b/examples/dicts/1k.txt @@ -1,1024 +0,0 @@ -the -of -and -to -a -in -for -is -on -that -by -this -with -i -you -it -not -or -be -are -from -at -as -your -all -have -new -more -an -was -we -will -home -can -us -about -if -page -my -has -search -free -but -our -one -other -do -no -information -time -they -site -he -up -may -what -which -their -news -out -use -any -there -see -only -so -his -when -contact -here -business -who -web -also -now -help -get -pm -view -online -c -e -first -am -been -would -how -were -me -s -services -some -these -click -its -like -service -x -than -find -price -date -back -top -people -had -list -name -just -over -state -year -day -into -email -two -health -n -world -re -next -used -go -b -work -last -most -products -music -buy -data -make -them -should -product -system -post -her -city -t -add -policy -number -such -please -available -copyright -support -message -after -best -software -then -jan -good -video -well -d -where -info -rights -public -books -high -school -through -m -each -links -she -review -years -order -very -privacy -book -items -company -r -read -group -sex -need -many -user -said -de -does -set -under -general -research -university -january -mail -full -map -reviews -program -life -know -games -way -days -management -p -part -could -great -united -hotel -real -f -item -international -center -ebay -must -store -travel -comments -made -development -report -off -member -details -line -terms -before -hotels -did -send -right -type -because -local -those -using -results -office -education -national -car -design -take -posted -internet -address -community -within -states -area -want -phone -dvd -shipping -reserved -subject -between -forum -family -l -long -based -w -code -show -o -even -black -check -special -prices -website -index -being -women -much -sign -file -link -open -today -technology -south -case -project -same -pages -uk -version -section -own -found -sports -house -related -security -both -g -county -american -photo -game -members -power -while -care -network -down -computer -systems -three -total -place -end -following -download -h -him -without -per -access -think -north -resources -current -posts -big -media -law -control -water -history -pictures -size -art -personal -since -including -guide -shop -directory -board -location -change -white -text -small -rating -rate -government -children -during -usa -return -students -v -shopping -account -times -sites -level -digital -profile -previous -form -events -love -old -john -main -call -hours -image -department -title -description -non -k -y -insurance -another -why -shall -property -class -cd -still -money -quality -every -listing -content -country -private -little -visit -save -tools -low -reply -customer -december -compare -movies -include -college -value -article -york -man -card -jobs -provide -j -food -source -author -different -press -u -learn -sale -around -print -course -job -canada -process -teen -room -stock -training -too -credit -point -join -science -men -categories -advanced -west -sales -look -english -left -team -estate -box -conditions -select -windows -photos -gay -thread -week -category -note -live -large -gallery -table -register -however -june -october -november -market -library -really -action -start -series -model -features -air -industry -plan -human -provided -tv -yes -required -second -hot -accessories -cost -movie -forums -march -la -september -better -say -questions -july -yahoo -going -medical -test -friend -come -dec -server -pc -study -application -cart -staff -articles -san -feedback -again -play -looking -issues -april -never -users -complete -street -topic -comment -financial -things -working -against -standard -tax -person -below -mobile -less -got -blog -party -payment -equipment -login -student -let -programs -offers -legal -above -recent -park -stores -side -act -problem -red -give -memory -performance -social -q -august -quote -language -story -sell -options -experience -rates -create -key -body -young -america -important -field -few -east -paper -single -ii -age -activities -club -example -girls -additional -password -z -latest -something -road -gift -question -changes -night -ca -hard -texas -oct -pay -four -poker -status -browse -issue -range -building -seller -court -february -always -result -audio -light -write -war -nov -offer -blue -groups -al -easy -given -files -event -release -analysis -request -fax -china -making -picture -needs -possible -might -professional -yet -month -major -star -areas -future -space -committee -hand -sun -cards -problems -london -washington -meeting -rss -become -interest -id -child -keep -enter -california -porn -share -similar -garden -schools -million -added -reference -companies -listed -baby -learning -energy -run -delivery -net -popular -term -film -stories -put -computers -journal -reports -co -try -welcome -central -images -president -notice -god -original -head -radio -until -cell -color -self -council -away -includes -track -australia -discussion -archive -once -others -entertainment -agreement -format -least -society -months -log -safety -friends -sure -faq -trade -edition -cars -messages -marketing -tell -further -updated -association -able -having -provides -david -fun -already -green -studies -close -common -drive -specific -several -gold -feb -living -sep -collection -called -short -arts -lot -ask -display -limited -powered -solutions -means -director -daily -beach -past -natural -whether -due -et -electronics -five -upon -period -planning -database -says -official -weather -mar -land -average -done -technical -window -france -pro -region -island -record -direct -microsoft -conference -environment -records -st -district -calendar -costs -style -url -front -statement -update -parts -aug -ever -downloads -early -miles -sound -resource -present -applications -either -ago -document -word -works -material -bill -apr -written -talk -federal -hosting -rules -final -adult -tickets -thing -centre -requirements -via -cheap -nude -kids -finance -true -minutes -else -mark -third -rock -gifts -europe -reading -topics -bad -individual -tips -plus -auto -cover -usually -edit -together -videos -percent -fast -function -fact -unit -getting -global -tech -meet -far -economic -en -player -projects -lyrics -often -subscribe -submit -germany -amount -watch -included -feel -though -bank -risk -thanks -everything -deals -various -words -linux -jul -production -commercial -james -weight -town -heart -advertising -received -choose -treatment -newsletter -archives -points -knowledge -magazine -error -camera -jun -girl -currently -construction -toys -registered -clear -golf -receive -domain -methods -chapter -makes -protection -policies -loan -wide -beauty -manager -india -position -taken -sort -listings -models -michael -known -half -cases -step -engineering -florida -simple -quick -none -wireless -license -paul -friday -lake -whole -annual -published -later -basic -sony -shows -corporate -google -church -method -purchase -customers -active -response -practice -hardware -figure -materials -fire -holiday -chat -enough -designed -along -among -death -writing -speed -html -countries -loss -face -brand -discount -higher -effects -created -remember -standards -oil -bit -yellow -political -increase -advertise -kingdom -base -near -environmental -thought -stuff -french -storage -oh -japan -doing -loans -shoes -entry -stay -nature -orders -availability -africa -summary -turn -mean -growth -notes -agency -king -monday -european -activity -copy -although -drug -pics -western -income -force -cash -employment diff --git a/examples/dicts/2k.txt b/examples/dicts/2k.txt @@ -1,2048 +0,0 @@ -the -of -and -to -a -in -for -is -on -that -by -this -with -i -you -it -not -or -be -are -from -at -as -your -all -have -new -more -an -was -we -will -home -can -us -about -if -page -my -has -search -free -but -our -one -other -do -no -information -time -they -site -he -up -may -what -which -their -news -out -use -any -there -see -only -so -his -when -contact -here -business -who -web -also -now -help -get -pm -view -online -c -e -first -am -been -would -how -were -me -s -services -some -these -click -its -like -service -x -than -find -price -date -back -top -people -had -list -name -just -over -state -year -day -into -email -two -health -n -world -re -next -used -go -b -work -last -most -products -music -buy -data -make -them -should -product -system -post -her -city -t -add -policy -number -such -please -available -copyright -support -message -after -best -software -then -jan -good -video -well -d -where -info -rights -public -books -high -school -through -m -each -links -she -review -years -order -very -privacy -book -items -company -r -read -group -sex -need -many -user -said -de -does -set -under -general -research -university -january -mail -full -map -reviews -program -life -know -games -way -days -management -p -part -could -great -united -hotel -real -f -item -international -center -ebay -must -store -travel -comments -made -development -report -off -member -details -line -terms -before -hotels -did -send -right -type -because -local -those -using -results -office -education -national -car -design -take -posted -internet -address -community -within -states -area -want -phone -dvd -shipping -reserved -subject -between -forum -family -l -long -based -w -code -show -o -even -black -check -special -prices -website -index -being -women -much -sign -file -link -open -today -technology -south -case -project -same -pages -uk -version -section -own -found -sports -house -related -security -both -g -county -american -photo -game -members -power -while -care -network -down -computer -systems -three -total -place -end -following -download -h -him -without -per -access -think -north -resources -current -posts -big -media -law -control -water -history -pictures -size -art -personal -since -including -guide -shop -directory -board -location -change -white -text -small -rating -rate -government -children -during -usa -return -students -v -shopping -account -times -sites -level -digital -profile -previous -form -events -love -old -john -main -call -hours -image -department -title -description -non -k -y -insurance -another -why -shall -property -class -cd -still -money -quality -every -listing -content -country -private -little -visit -save -tools -low -reply -customer -december -compare -movies -include -college -value -article -york -man -card -jobs -provide -j -food -source -author -different -press -u -learn -sale -around -print -course -job -canada -process -teen -room -stock -training -too -credit -point -join -science -men -categories -advanced -west -sales -look -english -left -team -estate -box -conditions -select -windows -photos -gay -thread -week -category -note -live -large -gallery -table -register -however -june -october -november -market -library -really -action -start -series -model -features -air -industry -plan -human -provided -tv -yes -required -second -hot -accessories -cost -movie -forums -march -la -september -better -say -questions -july -yahoo -going -medical -test -friend -come -dec -server -pc -study -application -cart -staff -articles -san -feedback -again -play -looking -issues -april -never -users -complete -street -topic -comment -financial -things -working -against -standard -tax -person -below -mobile -less -got -blog -party -payment -equipment -login -student -let -programs -offers -legal -above -recent -park -stores -side -act -problem -red -give -memory -performance -social -q -august -quote -language -story -sell -options -experience -rates -create -key -body -young -america -important -field -few -east -paper -single -ii -age -activities -club -example -girls -additional -password -z -latest -something -road -gift -question -changes -night -ca -hard -texas -oct -pay -four -poker -status -browse -issue -range -building -seller -court -february -always -result -audio -light -write -war -nov -offer -blue -groups -al -easy -given -files -event -release -analysis -request -fax -china -making -picture -needs -possible -might -professional -yet -month -major -star -areas -future -space -committee -hand -sun -cards -problems -london -washington -meeting -rss -become -interest -id -child -keep -enter -california -porn -share -similar -garden -schools -million -added -reference -companies -listed -baby -learning -energy -run -delivery -net -popular -term -film -stories -put -computers -journal -reports -co -try -welcome -central -images -president -notice -god -original -head -radio -until -cell -color -self -council -away -includes -track -australia -discussion -archive -once -others -entertainment -agreement -format -least -society -months -log -safety -friends -sure -faq -trade -edition -cars -messages -marketing -tell -further -updated -association -able -having -provides -david -fun -already -green -studies -close -common -drive -specific -several -gold -feb -living -sep -collection -called -short -arts -lot -ask -display -limited -powered -solutions -means -director -daily -beach -past -natural -whether -due -et -electronics -five -upon -period -planning -database -says -official -weather -mar -land -average -done -technical -window -france -pro -region -island -record -direct -microsoft -conference -environment -records -st -district -calendar -costs -style -url -front -statement -update -parts -aug -ever -downloads -early -miles -sound -resource -present -applications -either -ago -document -word -works -material -bill -apr -written -talk -federal -hosting -rules -final -adult -tickets -thing -centre -requirements -via -cheap -nude -kids -finance -true -minutes -else -mark -third -rock -gifts -europe -reading -topics -bad -individual -tips -plus -auto -cover -usually -edit -together -videos -percent -fast -function -fact -unit -getting -global -tech -meet -far -economic -en -player -projects -lyrics -often -subscribe -submit -germany -amount -watch -included -feel -though -bank -risk -thanks -everything -deals -various -words -linux -jul -production -commercial -james -weight -town -heart -advertising -received -choose -treatment -newsletter -archives -points -knowledge -magazine -error -camera -jun -girl -currently -construction -toys -registered -clear -golf -receive -domain -methods -chapter -makes -protection -policies -loan -wide -beauty -manager -india -position -taken -sort -listings -models -michael -known -half -cases -step -engineering -florida -simple -quick -none -wireless -license -paul -friday -lake -whole -annual -published -later -basic -sony -shows -corporate -google -church -method -purchase -customers -active -response -practice -hardware -figure -materials -fire -holiday -chat -enough -designed -along -among -death -writing -speed -html -countries -loss -face -brand -discount -higher -effects -created -remember -standards -oil -bit -yellow -political -increase -advertise -kingdom -base -near -environmental -thought -stuff -french -storage -oh -japan -doing -loans -shoes -entry -stay -nature -orders -availability -africa -summary -turn -mean -growth -notes -agency -king -monday -european -activity -copy -although -drug -pics -western -income -force -cash -employment -overall -bay -river -commission -ad -package -contents -seen -players -engine -port -album -regional -stop -supplies -started -administration -bar -institute -views -plans -double -dog -build -screen -exchange -types -soon -sponsored -lines -electronic -continue -across -benefits -needed -season -apply -someone -held -ny -anything -printer -condition -effective -believe -organization -effect -asked -eur -mind -sunday -selection -casino -pdf -lost -tour -menu -volume -cross -anyone -mortgage -hope -silver -corporation -wish -inside -solution -mature -role -rather -weeks -addition -came -supply -nothing -certain -usr -executive -running -lower -necessary -union -jewelry -according -dc -clothing -mon -com -particular -fine -names -robert -homepage -hour -gas -skills -six -bush -islands -advice -career -military -rental -decision -leave -british -teens -pre -huge -sat -woman -facilities -zip -bid -kind -sellers -middle -move -cable -opportunities -taking -values -division -coming -tuesday -object -lesbian -appropriate -machine -logo -length -actually -nice -score -statistics -client -ok -returns -capital -follow -sample -investment -sent -shown -saturday -christmas -england -culture -band -flash -ms -lead -george -choice -went -starting -registration -fri -thursday -courses -consumer -hi -airport -foreign -artist -outside -furniture -levels -channel -letter -mode -phones -ideas -wednesday -structure -fund -summer -allow -degree -contract -button -releases -wed -homes -super -male -matter -custom -virginia -almost -took -located -multiple -asian -distribution -editor -inn -industrial -cause -potential -song -cnet -ltd -los -hp -focus -late -fall -featured -idea -rooms -female -responsible -inc -communications -win -associated -thomas -primary -cancer -numbers -reason -tool -browser -spring -foundation -answer -voice -eg -friendly -schedule -documents -communication -purpose -feature -bed -comes -police -everyone -independent -ip -approach -cameras -brown -physical -operating -hill -maps -medicine -deal -hold -ratings -chicago -forms -glass -happy -tue -smith -wanted -developed -thank -safe -unique -survey -prior -telephone -sport -ready -feed -animal -sources -mexico -population -pa -regular -secure -navigation -operations -therefore -ass -simply -evidence -station -christian -round -paypal -favorite -understand -option -master -valley -recently -probably -thu -rentals -sea -built -publications -blood -cut -worldwide -improve -connection -publisher -hall -larger -anti -networks -earth -parents -nokia -impact -transfer -introduction -kitchen -strong -tel -carolina -wedding -properties -hospital -ground -overview -ship -accommodation -owners -disease -tx -excellent -paid -italy -perfect -hair -opportunity -kit -classic -basis -command -cities -william -express -anal -award -distance -tree -peter -assessment -ensure -thus -wall -ie -involved -el -extra -especially -interface -pussy -partners -budget -rated -guides -success -maximum -ma -operation -existing -quite -selected -boy -amazon -patients -restaurants -beautiful -warning -wine -locations -horse -vote -forward -flowers -stars -significant -lists -technologies -owner -retail -animals -useful -directly -manufacturer -ways -est -son -providing -rule -mac -housing -takes -iii -gmt -bring -catalog -searches -max -trying -mother -authority -considered -told -xml -traffic -programme -joined -input -strategy -feet -agent -valid -bin -modern -senior -ireland -sexy -teaching -door -grand -testing -trial -charge -units -instead -canadian -cool -normal -wrote -enterprise -ships -entire -educational -md -leading -metal -positive -fl -fitness -chinese -opinion -mb -asia -football -abstract -uses -output -funds -mr -greater -likely -develop -employees -artists -alternative -processing -responsibility -resolution -java -guest -seems -publication -pass -relations -trust -van -contains -session -multi -photography -republic -fees -components -vacation -century -academic -assistance -completed -skin -graphics -indian -prev -ads -mary -il -expected -ring -grade -dating -pacific -mountain -organizations -pop -filter -mailing -vehicle -longer -consider -int -northern -behind -panel -floor -german -buying -match -proposed -default -require -iraq -boys -outdoor -deep -morning -otherwise -allows -rest -protein -plant -reported -hit -transportation -mm -pool -mini -politics -partner -disclaimer -authors -boards -faculty -parties -fish -membership -mission -eye -string -sense -modified -pack -released -stage -internal -goods -recommended -born -unless -richard -detailed -japanese -race -approved -background -target -except -character -usb -maintenance -ability -maybe -functions -ed -moving -brands -places -php -pretty -trademarks -phentermine -spain -southern -yourself -etc -winter -rape -battery -youth -pressure -submitted -boston -incest -debt -keywords -medium -television -interested -core -break -purposes -throughout -sets -dance -wood -msn -itself -defined -papers -playing -awards -fee -studio -reader -virtual -device -established -answers -rent -las -remote -dark -programming -external -apple -le -regarding -instructions -min -offered -theory -enjoy -remove -aid -surface -minimum -visual -host -variety -teachers -isbn -martin -manual -block -subjects -agents -increased -repair -fair -civil -steel -understanding -songs -fixed -wrong -beginning -hands -associates -finally -az -updates -desktop -classes -paris -ohio -gets -sector -capacity -requires -jersey -un -fat -fully -father -electric -saw -instruments -quotes -officer -driver -businesses -dead -respect -unknown -specified -restaurant -mike -trip -pst -worth -mi -procedures -poor -teacher -xxx -eyes -relationship -workers -farm -fucking -georgia -peace -traditional -campus -tom -showing -creative -coast -benefit -progress -funding -devices -lord -grant -sub -agree -fiction -hear -sometimes -watches -careers -beyond -goes -families -led -museum -themselves -fan -transport -interesting -blogs -wife -evaluation -accepted -former -implementation -ten -hits -zone -complex -th -cat -galleries -references -die -presented -jack -flat -flow -agencies -literature -respective -parent -spanish -michigan -columbia -setting -dr -scale -stand -economy -highest -helpful -monthly -critical -frame -musical -definition -secretary -angeles -networking -path -australian -employee -chief -gives -kb -bottom -magazines -packages -detail -francisco -laws -changed -pet -heard -begin -individuals -colorado -royal -clean -switch -russian -largest -african -guy -titles -relevant -guidelines -justice -connect -bible -dev -cup -basket -applied -weekly -vol -installation -described -demand -pp -suite -vegas -na -square -chris -attention -advance -skip -diet -army -auction -gear -lee -os -difference -allowed -correct -charles -nation -selling -lots -piece -sheet -firm -seven -older -illinois -regulations -elements -species -jump -cells -module -resort -facility -random -pricing -dvds -certificate -minister -motion -looks -fashion -directions -visitors -documentation -monitor -trading -forest -calls -whose -coverage -couple -giving -chance -vision -ball -ending -clients -actions -listen -discuss -accept -automotive -naked -goal -successful -sold -wind -communities -clinical -situation -sciences -markets -lowest -highly -publishing -appear -emergency -developing -lives -currency -leather -determine -milf -temperature -palm -announcements -patient -actual -historical -stone -bob -commerce -ringtones -perhaps -persons -difficult -scientific -satellite -fit -tests -village -accounts -amateur -ex -met -pain -xbox -particularly -factors -coffee -www -settings -cum -buyer -cultural -steve -easily -oral -ford -poster -edge -functional -root -au -fi -closed -holidays -ice -pink -zealand -balance -monitoring -graduate -replies -shot -nc -architecture -initial -label -thinking -scott -llc -sec -recommend -canon -hardcore -league -waste -minute -bus -provider -optional -dictionary -cold -accounting -manufacturing -sections -chair -fishing -effort -phase -fields -bag -fantasy -po -letters -motor -va -professor -context -install -shirt -apparel -generally -continued -foot -mass -crime -count -breast -techniques -ibm -rd -johnson -sc -quickly -dollars -websites -religion -claim -driving -permission -surgery -patch -heat -wild -measures -generation -kansas -miss -chemical -doctor -task -reduce -brought -himself -nor -component -enable -exercise -bug -santa -mid -guarantee -leader -diamond diff --git a/examples/doubles.sh b/examples/doubles.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# this script quizzes you on words repeatedly, +# to try to get you to map them with their shapes! + +set -e + +read -p "How many letters? " LETTERCOUNT + +DICTFILE=./dict.txt + +SINGLES="$( \ +cat $DICTFILE | \ +egrep "^.{$LETTERCOUNT}$" | \ +shuf -n 20 | \ +tr "\n" " " | \ +xargs echo \ +)" + +for word in $SINGLES; do + typie -o /dev/null "$word $word $word" +done +typie -o /dev/null "$SINGLES" + +echo "All Done! :3" | less + diff --git a/examples/learn.sh b/examples/learn.sh @@ -13,15 +13,18 @@ on as id pg -km -jb +kb +kx +jm qw -yf -cr -lx vz -.>,< -'\";:" +yf +c. +r, +l? +v; +z- +1234567890" get_lesson() { echo "$LESSONS" | sed -n "${1}p" diff --git a/examples/lesson.sh b/examples/lesson.sh @@ -24,21 +24,21 @@ echo "If it gets too hard, don't be afraid to ctrl+C and redo previous lessons." echo "" echo "Introducing the new letters..." -typie -lf /dev/null "$(./words-by-letter.sh "$NEW_LETTERS" 6 12)" -typie -lf /dev/null "$(./words-by-letter.sh "$NEW_LETTERS" 6 12)" +typie -lo /dev/null "$(./words-by-letter.sh "$NEW_LETTERS" 6 12)" +typie -lo /dev/null "$(./words-by-letter.sh "$NEW_LETTERS" 6 12)" echo "Integrating with some old letters..." -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $MEDIUM)$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $MEDIUM)$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $HARD)$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$(old_letters $HARD)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $EASY)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $MEDIUM)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $MEDIUM)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $HARD)$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$(old_letters $HARD)$NEW_LETTERS" 5 8)" echo "All together now!" -typie -f /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)" -typie -f /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)" +typie -o /dev/null "$(./words-by-letter.sh "$OLD_LETTERS$NEW_LETTERS" 5 8)" echo "All done! :3" diff --git a/examples/practice.sh b/examples/practice.sh @@ -1,13 +1,7 @@ #!/bin/sh -# script that imitates monkeytype. +DICTFILE="./dict.txt" +PROMPT="$(shuf -n 50 $DICTFILE | tr "\n" " " | xargs echo)" -OUTFILE="~/typing/$(date +%F_%T)" - -DICTFILE="dicts/20k.txt" - -PROMPT="$(shuf -n 50 $DICTFILE | tr "\n" " ")" - -# typie -t 30 -f $OUTFILE "$PROMPT" -typie -t 30 "$PROMPT" +typie "$PROMPT" diff --git a/examples/words-by-letter.sh b/examples/words-by-letter.sh @@ -1,11 +1,16 @@ +#!/bin/sh + +# generates words given a series of letters and symbols. +# uses a dictionary to find whole words, +# or else just randomly picks a chunk of letters. CHARSET=$1 MIN_LENGTH=$2 MAX_LENGTH=$3 -DICTFILE="dicts/20k.txt" +DICTFILE="./dict.txt" -if [ $CHARSET = "" ]; then - echo "Requires charset argument." +if [ $MAX_LENGTH = "" ]; then + echo "Usage: words-by-letter.sh CHARSET MIN_LEN MAX_LEN" exit 1 fi @@ -19,17 +24,25 @@ if [ "$WORD_COUNT" -lt "$LENGTH" ]; then FEW_WORDS="true" fi -get_word() { +get_jumble() { ./letters.sh "$CHARSET" 4 6 } -if [ $FEW_WORDS = "true" ]; then - PROMPT="$(get_word)" - for i in $(seq $LENGTH); do - PROMPT="$PROMPT $(get_word)" - done - echo "$PROMPT" -else - echo "$WORDS" | shuf -n $LENGTH | xargs echo -fi +get_word() { + echo "$WORDS" | shuf -n 1 +} + +get_symbol() { + echo " $(echo $SYMBOLS | sed 's/./ /g')$SYMBOLS" | fold -b -w 1 | shuf -n 1 +} + +PROMPT="$(get_jumble)" +for i in $(seq $LENGTH); do + if [ $FEW_WORDS = "true" ]; then + PROMPT="$PROMPT$(get_symbol)$(get_jumble)" + else + PROMPT="$PROMPT$(get_symbol)$(get_word)" + fi +done +echo "$PROMPT" diff --git a/main.c b/main.c @@ -16,11 +16,11 @@ int line_lengths_buffer[MAX_LINES]; char chars_printed_buffer[MAX_PROMPT_LENGTH]; const char * usage =\ -"Usage: typie [-l] [-f FILE] [-t TIME] PROMPT" "\n"\ +"Usage: typie [-l] [-o OUTFILE] [-t TIME] PROMPT" "\n"\ "\n"\ -" -l no backspacing, incorrect keys not accepted" "\n"\ -" -f FILE file to write output to (stdout if unspecified)" "\n"\ -" -t TIME exit after TIME seconds" "\n"\ +" -l no backspacing, incorrect keys not accepted" "\n"\ +" -o OUTFILE file to write output to (defaults to stdout)" "\n"\ +" -t TIME exit after TIME seconds" "\n"\ /* " -m output mistakes after completion" "\n" */\ "\n"\ "See the man page for more details." "\n"\ @@ -123,7 +123,7 @@ write_output(State state) if (state.flags & FLAG_FILE) { fclose(out); } else { - printf("\n\n"); + fprintf(out, "\n"); } } @@ -191,7 +191,7 @@ main(int argc, const char * argv[]) exit(1); } - printf("\033[%dB", state.max_row - state.row); + printf("\033[%dB", state.max_row - state.row - 1); restore_termios(termios_original); printf(COLOR_RESET "\n"); diff --git a/opt.c b/opt.c @@ -31,7 +31,7 @@ get_flag(char c) { switch (c) { case 'l': return FLAG_LEARN_MODE; - case 'f': return FLAG_FILE; + case 'o': return FLAG_FILE; case 't': return FLAG_TIME; } diff --git a/typer.c b/typer.c @@ -122,7 +122,7 @@ remove_jump(State * state) } void -show_remaining(State * state) +show_remaining(State * state, int reset_color) { /* print the rest of the string after index, at the cursor. */ const char * prompt = state->prompt; @@ -130,7 +130,9 @@ show_remaining(State * state) int steps = 0; char c; - PRINT_CONTROL(COLOR_RESET CLEAR_TO_LINE_END); + if (reset_color) + PRINT_CONTROL(COLOR_RESET); + PRINT_CONTROL(CLEAR_TO_LINE_END); if (prompt[index] == '\0') return; @@ -183,7 +185,7 @@ on_correct(State * state, char c) add_jump(state, 1); state->index++; - show_remaining(state); + show_remaining(state, 1); } void @@ -196,7 +198,7 @@ on_incorrect(State * state, char c) PRINT_CONTROL(COLOR_RED); if (state->flags & FLAG_LEARN_MODE) { print_char(state, c, 1); - show_remaining(state); + show_remaining(state, 1); cursor_back(state, 1); return; } @@ -225,7 +227,7 @@ on_incorrect(State * state, char c) /* extra letters at the end of a chunk */ print_char(state, c, 1); add_jump(state, 0); - show_remaining(state); + show_remaining(state, 1); return; } @@ -240,7 +242,7 @@ on_backspace(State * state) int jump; if (state->flags & FLAG_LEARN_MODE) { - show_remaining(state); + show_remaining(state, 1); return; } @@ -250,13 +252,13 @@ on_backspace(State * state) jump = remove_jump(state); if (jump == 0) { cursor_back(state, 1); - show_remaining(state); + show_remaining(state, 1); return; } cursor_back(state, jump); state->index -= jump; - show_remaining(state); + show_remaining(state, 1); } int @@ -268,7 +270,8 @@ on_enter(State * state) void start_typing(State * state) { - show_remaining(state); + printf(COLOR_BOLD); + show_remaining(state, 0); } int diff --git a/typie.1 b/typie.1 @@ -4,7 +4,7 @@ typie \- simple typing practice .SH SYNOPSIS .B typie .RB [ \-l ] -.RB [ \-f +.RB [ \-o .IR OUTFILE ] .RB [ \-t .IR TIME ] @@ -17,7 +17,7 @@ is a simple typing practice program. .B \-l "learn mode": ignores repeated misinputs, disallows backspacing. .TP -.BI \-f " OUTFILE" +.BI \-o " OUTFILE" write results, if any, to OUTFILE. Defaults to stdout. .TP .BI \-t " TIME"

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