https://github.com/fspv/leetcode-anki
Anki cards generator for Leetcode
https://github.com/fspv/leetcode-anki
anki leetcode python
Last synced: about 1 month ago
JSON representation
Anki cards generator for Leetcode
- Host: GitHub
- URL: https://github.com/fspv/leetcode-anki
- Owner: fspv
- License: mit
- Created: 2021-09-21T22:46:17.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-26T22:48:54.000Z (4 months ago)
- Last Synced: 2025-04-12T04:47:56.271Z (2 months ago)
- Topics: anki, leetcode, python
- Language: Python
- Homepage:
- Size: 75.2 KB
- Stars: 339
- Watchers: 5
- Forks: 47
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README




# Leetcode Anki card generator
## Summary
By running this script you'll be able to generate Anki cards with all the leetcode problems.I personally use it to track my grinding progress.



## Prerequisites
1. [python3.8+](https://www.python.org/downloads/) installed
2. [python virtualenv](https://pypi.org/project/virtualenv/) installed
3. [git cli](https://github.com/git-guides/install-git) installed
4. [GNU make](https://www.gnu.org/software/make/) installed (optional, can run the script directly)
5. \*nix operating system (Linux, MacOS, FreeBSD, ...). Should also work for Windows, but commands will be different. I'm not a Windows expert, so can't figure out how to make it work there, but contributions are welcome.## How to run
First download the source code
```sh
git clone https://github.com/prius/leetcode-anki.git
cd leetcode-anki
```After that initialize and activate python virtualenv somewhere
Linux/MacOS
```sh
virtualenv -p python leetcode-anki
. leetcode-anki/bin/activate
```Windows
```sh
python -m venv leetcode-anki
.\leetcode-anki\Scripts\activate.bat
```Then initialize necessary environment variables. You can get it directly from your browser cookies (`csrftoken` and `LEETCODE_SESSION`)
Linux/Macos
```sh
export LEETCODE_CSRF_TOKEN="xxx"
export LEETCODE_SESSION_ID="yyy"
```Windows
```sh
set LEETCODE_CSRF_TOKEN="xxx"
set LEETCODE_SESSION_ID="yyy"
```And finally run for Linux/MacOS
```sh
make generate
```
Or for Windows
```sh
pip install -r requirements.txt
python generate.py
```You'll get `leetcode.apkg` file, which you can import directly to your anki app.