Logo

dev-resources.site

for different kinds of informations.

Small prototype... easy coding flash cards on android

Published at
11/7/2024
Categories
python
termux
cli
learning
Author
taijidude
Categories
4 categories in total
python
open
termux
open
cli
open
learning
open
Author
9 person written this
taijidude
open
Small prototype... easy coding flash cards on android

My Problem...

I recently read the wonderful book the-programmers-brain. One take-away was that if you study concepts with flash cards it will help learn new stuff more efficiently. So i was looking for a while now how to do that using my android phone.

I'm a pretty heavy obsidian user and had a look at the plugins i knew of but was not really satisfied and looked and some apps. This didn't really worked easly or made me jump through more hoops than i wanted to.

I'm no Android Developer yet and not really a web dev either. I want to use flash cards to learn angular and typescript, so my options were a litte limited. Here is what i came up with:

My Solution...

There is a fantastic app called termux on android which gives you a complete linux environment.

termux

In termux you are able to work with python and git. So i came up with a small python project containing of one python script and a markdown file at the moment.

The python file uses the rich library because i can render markdown pretty to the cli (with syntax highlighting).

from rich.console import Console
from rich.markdown import Markdown

def main():
    console = Console()
    with open("angular.md") as f:
        content: str = f.read()
        cards: list[str] = content.split('<!-- Card -->')
        numberOfCards: int = len(cards)
        for card in cards:
            console.clear()
            sides = card.split('<!-- Sides -->')
            console.print(Markdown(sides[0])) 
            input("\nshow the answer!")
            console.print(Markdown(sides[1]))
            input("\nnext card!")
            console.clear()
if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

The content of my flashcards is stored in a markdown file. I use html comments to seperate the individual cards and the question and the answer on each individual card.

Image description

I have this all on a little github project. github. (The name of the project will change.) S

On my phone i have to clone the repo in termux:

git clone https://github.com/taijidude/mochi-cards.git
Enter fullscreen mode Exit fullscreen mode

Install the needed dependencies (typer is a neat cli framework which brings the rich library as dependency. I use typer here because i want to do more with it in the future. )

pip install typer
Enter fullscreen mode Exit fullscreen mode

and than can run the app:

python app.py
Enter fullscreen mode Exit fullscreen mode

Finally i get a basic flashcard functionality with syntax highlighting.
After starting:
Image description
When hitting enter the answer is shown:

Image description

When hitting enter again i get the next question:

Image description

Thank you for your Attention!

termux Article's
30 articles in total
Favicon
่ฎฉๅฎ‰ๅ“ๆ‰‹ๆœบไธๅ†ๅƒ็ฐ๏ผšๅœจๅฎ‰ๅ“ๆ‰‹ๆœบไธŠๆญๅปบ Rust ๅผ€ๅ‘็Žฏๅขƒ
Favicon
How to install React and Tailwind in Termux
Favicon
Small prototype... easy coding flash cards on android
Favicon
Run qBittorrent in Android
Favicon
Setup pygame in termux
Favicon
Termux-Ngrok Configuration
Favicon
How To Install Termux Box In Termux
Favicon
My personal detox command
Favicon
Como rodar um servidor NodeJS em um smartphone Android
Favicon
Run a Linux Distro in your Android device
Favicon
Install Official VS Code on Android
Favicon
Automatically Change IP Address ุชุบูŠุฑ ุงูŠ ุจูŠ ุจุดูƒู„ ุชู„ู‚ุงุฆูŠ ูƒุงู„ูŠ ู„ูŠู†ูƒุณ
Favicon
Linux On The Go (Termux)
Favicon
How To Install Lemon Rat In Termux 2024
Favicon
git diary
Favicon
Line Highlighting in Zsh Termux
Favicon
How To Install Code-Server On Android
Favicon
Installing NodeJS In Termux
Favicon
Obsidian Notes with git-crypt ๐Ÿ”
Favicon
Install Pfetch on Termux
Favicon
Youtube Two Click MP3 Downloader - Termux!
Favicon
HOW TO INSTALL NGROK IN TERMUX ANDROID
Favicon
Setting up Termux and a Linux Distro on Android
Favicon
New Github Repo
Favicon
Termux logo in python
Favicon
Termux getting terminated after 15s on starting the VNC server.
Favicon
Setting Up Termux and Node.js on Android for Web Development
Favicon
Programando pelo Tablet
Favicon
How to connect your android device to github using ssh key with termux
Favicon
Host TOR Hidden service (DARK WEB website) on a smartphone !!

Featured ones: