Skip to content

n-samaali/auto-leet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AutoLeet : LeetCode to GitHub synchronization tool

This repository automatically syncs your accepted LeetCode submissions to GitHub, organizing them by problem ID and including problem descriptions.

Quick Start

  1. Install dependencies:

    pip install -r requirements.txt
  2. Edit the setup file for your OS:

    • Linux/macOS: setup.sh
    • Windows: setup.bat
  3. Fill in your credentials:

    setup.sh :

    # LeetCode
    export LEETCODE_SESSION="your_session_cookie"
    export CSRFTOKEN="your_csrf_token"
    
    # GitHub
    export GIT_PAT="your_github_personal_access_token"
    export REPO_URL="https://github.com/yourusername/yourrepo.git"

    setup.bat :

    @echo off
    REM LeetCode
    set "LEETCODE_SESSION=your_session_cookie"
    set "CSRFTOKEN=your_csrf_token"
    
    REM GitHub
    set "GIT_PAT=your_github_personal_access_token"
    set "REPO_URL=https://github.com/yourusername/yourrepo.git"
  4. Run it!
    Linux/macOS:

    chmod +x setup.sh && ./setup.sh

    Windows:

    setup.bat

That's it! Your LeetCode solutions will appear in the repo organized by problem.

What Gets Synced?

βœ… All accepted submissions
βœ… Preserved runtime/memory stats
βœ… Problem descriptions in READMEs
βœ… Supports 25+ programming languages

File Structure

β”œβ”€β”€ 0001-two-sum/
β”‚   β”œβ”€β”€ two-sum-1234567890.py
β”‚   └── README.md
β”œβ”€β”€ 0002-add-two-numbers/
β”‚   β”œβ”€β”€ add-two-numbers-1234567891.java
β”‚   └── README.md
└── ...

Need Help?

  1. Get LeetCode cookies:

    • Log in to LeetCode
    • Open DevTools (F12) β†’ Application β†’ Cookies
    • Copy LEETCODE_SESSION and csrftoken values
  2. Create GitHub PAT:

    • Settings β†’ Developer settings β†’ Personal Access Tokens
    • Select repo permissions
  3. Proxy issues?
    Set these in the setup file if needed:

    setup.sh :

    export HTTP_PROXY="your_proxy"
    export HTTPS_PROXY="your_proxy"

    setup.bat :

    set "HTTP_PROXY=your_proxy"
    set "HTTPS_PROXY=your_proxy"

πŸ’‘ Pro Tip: Run this weekly to keep your solutions backed up!

About

A python script to retrieve and push onto GitHub accepted LeetCode submissions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published