Package sbx

📚📦 StudyBox (SBX) - Terminal Flashcards

screenshot

PyPI version Python: 3.6+ Code style: black Imports: isort



Credits 🙇‍♂️

  • Sm2 - Algorithm by Super Memo
  • prompt-toolkit - TUI library. 😎

Why ? 🤔

  • Wanted a flashcard solution that uses markdown.
  • I wanted to memorise useful information.
  • GitHub/Gitlab/etc,.. readable flashcards.

Installation (Unix, Windows)

Install from PyPI (pipx)

pipx install sbx
  • Alternatively you can install it using pip3 install sbx (On some OSes this is pip install sbx)

Install latest with pipx

git clone git@github.com:JaDogg/sbx.git
cd sbx
pipx install .

Install latest with setup.py

git clone git@github.com:JaDogg/sbx.git
cd sbx
python setup.py install

Features

  • It's markdown. (You can use your own editor, as long as you maintain comments in it)
  • Syntax highlighting.
  • List files. (leech, last one marked with lowest score, include all, etc.)
  • Use your own folder structure. (Study at any level in your structure, recursive or not is up to you)
  • Built in editor which shows front and back of the flashcards.
  • Push your files to github and you can read them.

This software is Copyright (c) 2020 - 2022 Bhathiya Perera.

See the LICENSE file for more information.

Usage Guide

  • sbx is a command line application.
  • sbx is also a python library.
    • This means you can write your own scripts using sbx.core features.

Help

# To get help for sbx try running
sbx --help

Q & A

How do I create a new card file?

sbx create python-for-loop.md
  • You can now edit it using any editor.

How do I edit a card file using built in editor?

sbx edit python-for-loop.md

How do I list files I need to study today with recursive scanning?

cd my-flash-cards-location
sbx list -rn .

I want to reset the state of a flash card, How do I do it?

sbx reset java-iterable.md

How do I reset all cards in a directory (ex: 'coding')

sbx list -irn coding | tr '\n' '\0' | xargs -0 -L1 sbx reset
  • Parameter -i include all files.
  • Parameter -r searches recursively.
  • Parameter -n lists only names.
  • tr command converts new lines to zero terminated.
  • xargs splits by zero (-0), uses only 1 input (-L1) and call sbx reset FILENAME
  • (This assumes bash like shell in unix environment with tr and xargs present).

I want to list cards that I don't remember properly?

cd my-flash-cards-location
sbx list -rnil .
  • Parameter -r searches recursively.
  • Parameter -n lists only names.
  • Parameter -i include all files.
  • Parameter -l filter by leech cards.

I marked some cards as zero last time, how do I find them?

cd my-flash-cards-location
sbx list -rniz .
  • Parameter -r searches recursively.
  • Parameter -n lists only names.
  • Parameter -i include all files.
  • Parameter -z only list cards that were last marked as zero.

How do I start a study session for content in current directory (non-recursive)?

cd exam-cards
sbx study .

Or

sbx study exam-cards
  • In this mode you get to first guess the answer.
  • You can type it in scratch pad area.
  • Scratch pad area get reset when you go to next card.
  • After selecting a show back, you can then select how much you remember.
  • Press F1 for help. (Note: Some terminal emulators might associate it with something else)

How do I exit a study session or editing?

  • Press Ctrl+E to exit. (This is the default shortcut)

How do I write a file after editing it?

  • Press Ctrl+W to write.

How do I navigate in edit session or study session?

  • Press Ctrl + arrow keys.

Project Plan

  • [ ] Support tags.
  • [ ] Plugin Support
    • [ ] Different kinds of plugins? Hooks? need to think of this
  • [ ] Configurable Keys
  • [ ] Statistics?
  • [ ] Support ASCII drawing
  • [ ] Support for different algorithms.
  • [x] Support for leech detection
  • [x] Leech in info box
  • [ ] Leech in different colour?
  • [x] Leech in list
  • [x] Last quality zero in list
  • [ ] Test with 100,000 cards (Performance)
  • [ ] Auto Save Plugin?
  • [ ] ASCII Plugin
  • [x] Make the scratch pad editable always
  • [x] No need to have 1-6 shortcuts
  • [x] On show or when 1-6 is clicked focus on the text box
    • So you can practice
  • [x] Keep the last sessions in a string (string stack) :)
  • [ ] ~Create a new algorithm that can use a gradient descent based on past scores need minimum 5 items but if we have about 20 or more we can be more confident.~ - maybe later
  • [ ] Implement Sm2+ - http://www.blueraja.com/blog/477/a-better-spaced-repetition-learning-algorithm-sm2
  • [ ] Implement Sm4
  • [ ] Package config: .sbx.ini
    • [ ] Command to create package config
    • [ ] Commands to change package config
    • [ ] Package level algorithms
  • [x] Past stat graph
  • [ ] Days due - For Sm2 this is := today - scheduled + 1
  • [x] Create register based storage in cards - a,b,c,d,e,f,g,h,last,next,pastq,reps,algo
    • [ ] Once this is done I can release this to public
    • [ ] Prepare for release by refactoring
  • [x] Info - show actual rep
-  |
q 6|             ** *
u 5|            *  * 
a 4|     ***** * 
l 3| *   *     *
i 2|* * *
t 1|   *
y 0|
-  ---------------------
    1       10        20
       -- reps --
Expand source code
"""
.. include:: ../README.md
.. include:: ../docs/USAGE.md
.. include:: ../docs/TODO.md
"""

Sub-modules

sbx.cli

SBX Command line interface functionality

sbx.core

Core Study Box classes …

sbx.ui

User interface classes