leetcode-cli
Installing
# Required dependencies:
#
# gcc
# libssl-dev
# libdbus-1-dev
# libsqlite3-dev
Usage
Make sure you have logged in to leetcode.com
with Chrome
. See Cookies for why you need to do this first.
)
Example
For example, given this config (can be found in ~/.leetcode/leetcode.toml
, it can be generated automatically with command: leetcode list
if you are a new user):
[]
= "rust"
= "emacs"
# Optional parameter
= ['-nw']
1. pick
2. edit
# ;
3. test
4. exec
Cookies
The cookie plugin of leetcode-cli can work on OSX and Linux. If you are on a different platform, there are problems with caching the cookies, you can manually input your LeetCode Cookies to the configuration file.
[]
= "..."
= "..."
For Example, using Chrome (after logging in to LeetCode):
Step 1
Open Chrome and navigate to the link below:
chrome://settings/cookies/detail?site=leetcode.com
Step 2
Copy Content
from LEETCODE_SESSION
and csrftoken
to session
and csrf
in your configuration file, respectively:
[]
= "${csrftoken}"
= "${LEETCODE_SESSION}"
Programmable
If you want to filter LeetCode questions using custom Python scripts, add the following to your the configuration file:
[]
= "scripts"
Then write the script:
# ~/.leetcode/scripts/plan1.py
;
##
# `print` in python is supported,
# if you want to know the data structures of these two args,
# just print them
##
=
=
=
=
= ;
# return is `List[string]`
return
Then run list
with the filter that you just wrote:
And that's it! Enjoy!
PR
PRs are more than welcome!
LICENSE
MIT