Ankiweb.net console client. Manage Anki flashcards without a friction.
Use AUR package https://aur.archlinux.org/packages/runki
For other systems you can install runki through go get
:
- Install go.
- Execute
go get github.com/seletskiy/runki
All command line arguments can be stored in configuration file called
~/.config/runki/runkirc
with following format:
--[option
[value]]
Example:
--user
user@example.com
--pass
password
--deck
english
All further invocations of runki
can be done without specifying user/pass/deck
arguments.
See runki --help
for complete arguments list.
Add card to ankiweb.net:
echo test | runki
# or
echo test | runki --user=<USERNAME> --pass=<PASSWORD> --deck=<DECKNAME>
Add list of cards to ankiweb.net:
cat words-list | runki
Add clipboard contents to ankiweb.net:
echo xclip -selection clipboard -o | runki
Add current selection to ankiweb.net:
echo xclip -o | runki
Add current selection to ankiweb.net and show translation:
notify-send "$(xclip -o | runki)"
Create file ~/bin/add-anki-word with following contents:
#!/bin/bash
notify-send "$(echo $(xclip -o) | runki)"
Execute following command:
echo "bindsym \$mod+Escape exec add-anki-word" >> ~/.i3/config && i3-msg reload
Now it's possible to highlight unknown word in the browser and press only one shortcut to get word be added into your Anki account.
It is possible to learn foreign words directly from Kindle. When you encounter unknown word, just tap on it, then select "Highlight". All this highlights will be saved to the file "/documents/My Clippings.txt" in the Kindle FS.
Afterwards this file can be filtered to extract single word highlights (see example script here: https://github.com/seletskiy/dotfiles/blob/92a0e8fdb533106d700dc4c7415f4d41b232edff/bin/kindle-filter-words).
So, all highlighted words can be easily added to Anki like this:
kindle-filter-words "/mnt/documents/My Clippings.txt" | tac | runki --cut 3
Note, that tac
command will reverse incoming list so most recent items will
came first. --cut 3
flag tells runki to exit if it detect at least 3
words
that are already added to Anki. tac
and --cut
combination allows you to
sync words from Kindle in seamless way just running one single command again
and again.
Ok, let's go deeper. One probably want to sync words that was highlighted on the kindle automatically when one connect kindle to the computer.
So, we need to create udev rule like this:
ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", ENV{ID_VENDOR_ID}=="1949", RUN+="/usr/bin/su <USERNAME> -lc 'DISPLAY=:0 kindle-to-anki $env{DEVNAME}'"
After kindle is connected, kindle-to-anki
program will have to be runned.
It will add new words directly to Anki and show nice notification about how
many new words has been added to.
Example of this kindle-to-anki
program can be found there: https://github.com/seletskiy/dotfiles/blob/1c9da6d347cc658c9d6d177a61ef94423a3c36d4/bin/kindle-to-anki
0.0.1