Skip to content

chentze02/leetcode-notion-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

LinkedIn

Demo

screen-recording-2023-06-03-at-100020-pm_kEZxkkvz.2.mov

LeetCode Notion Tracker

Quick way to keep track of problems you solved on Notion by running a python script

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

The LeetCode Notion Tracker is a Python script that allows you to easily track your progress in solving LeetCode questions by integrating with Notion, a popular productivity and note-taking tool. With this script, you can conveniently add LeetCode questions to your Notion database and keep track of the questions you have completed.

Features

  • Question Tracking: The script allows you to add LeetCode questions to your Notion database and update the status of completed questions.
  • Automatic Data Retrieval: It retrieves question information from the LeetCode API, such as difficulty level and question title.
  • Notion Integration: Utilizes the Notion API to create and update pages in your Notion database.
  • Command-Line Interface: You can interact with the script through a command-line interface by providing the LeetCode question number as an argument.

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • Python
    Python 3.11
  • EnvFile
    pip install python-dotenv
  • Notion
    Read the Notion Docs on how to obtain a NOTION TOKEN
    

Installation

  1. Clone the repo
    git clone https://github.com/chentze02/leetcode-notion-tracker.git

2.Setup your token and database id

Option 1 (RECOMMENDED)
  1. Install the python-dotenv package by running pip install python-dotenv in your terminal.

  2. Create an environment file (e.g., .env) in the /usr/local directory and populate it with your sensitive information:

NOTION_TOKEN=YOUR_NOTION_TOKEN DATABASE_ID=YOUR DATABASE ID

Ensure that the environment file has the appropriate permissions set to protect the sensitive data.

  1. Update the script to load the environment variables from the file using load_dotenv() function from the dotenv module. Provide the path to your environment file as an argument to load_dotenv().

Make sure to replace /usr/local/.env with the correct path to your environment file.

Option 2

Enter your DATABASE KEY and NOTION TOKEN in the MACROS

# TOKEN AND IDS
NOTION_TOKEN = "YOUR_NOTION_TOKEN" 
DATABASE_ID = "YOUR_DATABASE_ID"

(back to top)

Make it a Bash Command

To set up the LeetCode Notion Tracker script as a bash command, follow these steps:

  1. Open a terminal.

  2. Navigate to the directory where the script is located.

  3. Rename the script file to leetcode without the .py extension.

    mv leetcode-tracker.py leetcode

  4. Make the script executable.

    chmod +x leetcode

  5. Move the script to the /usr/local/bin directory.

    sudo mv leetcode /usr/local/bin/

    You will be prompted to enter your password for the sudo command.

  6. Verify the installation by running the command leetcode <leetcode_number> in the terminal. Replace <leetcode_number> with the actual LeetCode question number.

Now you can use the leetcode command as if it was a built-in bash command.

Usage

To add or update a LeetCode question in your Notion database, follow these steps:

  1. Open a terminal or command prompt.
  2. Navigate to the directory where the script is located.
  3. Run the script using the command python your_script.py <leetcode_number>, replacing <leetcode_number> with the actual question number.
  4. The script will fetch the question details from the LeetCode API and check if the question already exists in your Notion database.
  5. If the question exists, it will update the question's status with the current date and time.
  6. If the question does not exist, it will create a new entry in your Notion database with the question details and set the status to the current date and time.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Your Name - chentzen02@g.ucla.edu

Project Link: https://github.com/chentze02/leetcode-notion-tracker

(back to top)

Disclaimer

This script is not affiliated with LeetCode or Notion. It is an independent tool developed to enhance the tracking of LeetCode question progress using Notion.

About

Track completed leetcode problems on Notion

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages