All Projects → chishui → Terminal Leetcode

chishui / Terminal Leetcode

Licence: mit
Terminal-Leetcode is a terminal based leetcode website viewer.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Terminal Leetcode

Interviewguide
《大厂面试指北》——包括Java基础、JVM、数据库、mysql、redis、计算机网络、算法、数据结构、操作系统、设计模式、系统设计、框架原理。最佳阅读地址:http://notfound9.github.io/interviewGuide/
Stars: ✭ 3,117 (+1427.94%)
Mutual labels:  leetcode
Gotty Client
🔧 terminal client for GoTTY
Stars: ✭ 196 (-3.92%)
Mutual labels:  terminal
Tty
Toolkit for developing sleek command line apps.
Stars: ✭ 2,329 (+1041.67%)
Mutual labels:  terminal
Tech Interview Preparation
A one stop solution to ace your next coding interview 👨‍💻
Stars: ✭ 188 (-7.84%)
Mutual labels:  leetcode
Aminal
🌘 Darktile is a GPU rendered terminal emulator designed for tiling window managers.
Stars: ✭ 2,663 (+1205.39%)
Mutual labels:  terminal
Tslide
Terminal SlideDeck, supporting markdown.
Stars: ✭ 198 (-2.94%)
Mutual labels:  terminal
Bashhub Server
Private cloud shell history. Open source server for bashhub https://github.com/rcaloras/bashhub-client
Stars: ✭ 189 (-7.35%)
Mutual labels:  terminal
Saldl
A lightweight well-featured CLI downloader optimized for speed and early preview.
Stars: ✭ 203 (-0.49%)
Mutual labels:  terminal
Htop
htop - an interactive process viewer
Stars: ✭ 3,076 (+1407.84%)
Mutual labels:  terminal
Qrc
QR code generator for text terminals (ASCII art, Sixel)
Stars: ✭ 200 (-1.96%)
Mutual labels:  terminal
Blog
想法,沉淀,总结,赋能
Stars: ✭ 194 (-4.9%)
Mutual labels:  leetcode
Leetcode
LeetCode in pure C
Stars: ✭ 2,487 (+1119.12%)
Mutual labels:  leetcode
Arts
每周一道算法一本书
Stars: ✭ 199 (-2.45%)
Mutual labels:  leetcode
Learning
自己整理了一些网上和书籍中的知识与笔记,来应对技术面试可能遇到的一些问题,包括算法、操作系统、计算机网络、Java、C++、Python、Go。概念不是最重要的!概念不是最重要的!概念不是最重要的!练习题才是!重要的事情说三遍,概念是不是看了很多遍,看几遍忘几遍,题目做过几遍,是不是印象很深,精华是题目,笔者在大量练习后摘录了书籍、牛客网、赛码网、W3C、CSDN等各种渠道的练习题,较为基础的这里就不录入了,主要录入一些易混淆,不容易理解的题目。作者也不喜欢重复造轮子,某些知识点的解释有比较详细的博客,作者就简单引用了,只有作者觉得找不到解释较好的博客时,作者会自己写一篇然后引用,限于篇幅,具体还请点击链接详细了解。
Stars: ✭ 194 (-4.9%)
Mutual labels:  leetcode
Ascii
👾 ASCII Roulette :: ascii art video chat on the cli
Stars: ✭ 202 (-0.98%)
Mutual labels:  terminal
Algorithm
Leetcode 组队刷题
Stars: ✭ 193 (-5.39%)
Mutual labels:  leetcode
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+2067.65%)
Mutual labels:  terminal
Effective Shell
Text, samples and website for my 'Effective Shell' series.
Stars: ✭ 204 (+0%)
Mutual labels:  terminal
Zero
A 3D renderer written in JavaScript and rendered to the terminal.
Stars: ✭ 2,307 (+1030.88%)
Mutual labels:  terminal
Nord Terminal App
An arctic, north-bluish clean and elegant Terminal.app color theme.
Stars: ✭ 198 (-2.94%)
Mutual labels:  terminal

Terminal-Leetcode

Terminal-Leetcode is a terminal based leetcode website viewer.
This project is inspired by RTV.

alt text


Build Status PyPI PyPI

Discuss in Slack

March 22th Update

Add code submit function.

After finishing your code, press s at quiz detail view to submit your code to leetcode.

Add company tag support.

You can company tag to terminal-leetcode home view column. The tag file is in JSON format which can be easily
edit and share. You can find tag file of Facebook from tags directory.


Requirements

Installation

Install with pip

 $ pip install terminal-leetcode

Clone the repository

 $ git clone https://github.com/chishui/terminal-leetcode.git  
 $ cd terminal-leetcode  
 $ sudo python setup.py install  

For Ubuntu

Need to install lxml dependencies first on Ubuntu.

apt-get install libxml2-dev libxslt1-dev python-dev

Usage

To run the program, input leetcode in terminal

 $ leetcode

Login

Option 1

This option will get your cookies from your browser and use those for any requests agains leetcode website. So you need to sign in your account from your browser first. There may be some limitations, please refer to pycookiecheat for its documentation

Option 2 (No longer available)

To login you need to create a config.cfg file in folder ~/.config/leetcode.
Input your username and password in config.cfg as:

[leetcode]
username=chishui
password=123456

Then restart this program.

Programming Language

You can set your programming language in config.cfg as:

[leetcode]
........
language=Java

to see default sample code in quiz detail view in your favorite language.
Please make sure to use Leetcode supported programming languages and use the string exactly the same as it appears in Leetcode.

Tags

You can customize your "Tag" column by adding a json file named tag.json into ~/.config/leetcode folder.
The format of tag.json is showed below:

{
  "1" : ["F", "G"],
  "10" : ["F"],
  ......
}

By adding this file, quiz 1 will have a "F" and "G" tag and quiz 10 will have a "F" tag.
You can use this feature to add company tag on quizzes.
I have added a "F" tag sample file in "tags" folder. You could try this file to see all "F" tag quizzes.

Writing Code

Terminal-Leetcode allows you to open editor to edit default code you are viewing.
You can set your code editing settings in config.cfg as:

[leetcode]
........
ext=java # file extention
path=~/program/leetcode # code file directory

Then when you are in quiz detail view, press e to open editor to edit code sample.
Code sample is saved into directory you set in config.cfg automatically with file name combined with quiz id and file extension you set.
Default editor is vim, you can set export EDITOR=*** to change editor. You can refer to this article to use Sublime Text as command line editor.

Tmux Support

If you're using Terminal-Leetcode inside of a tmux session, when you press e, current tmux window will be splitted vertically and an editor is opened inside the new created tmux pane. This feature could be turned on and off by config option in config.cfg as:

[leetcode]
........
tmux_support=true/false

Note that when you press e in detail view, all other panes in current tmux window except for the detail pane will be closed before the new edit pane is created, so that you can edit solution for another problem seamlessly without manually exiting vim and closing the edit pane.

Code Snippet

Two code snippets can be used when creating code file.
You can create files before and after in ~/.config/leetcode/snippet. Code snippet in before will be placed at the beginning of the code file. Code snippet in file after will be placed at the end of the code file.
Like in C++, write

#include <iostream>
#include <vector>

using namespace std;

in file before and

int main() {
    Solution s;
}

in file after, then you can view code of quiz (take quiz 123 for example) as:

#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int maxProfit(vector<int>& prices) {
        
    }
};

int main() {
    Solution s;
}

It becomes much easier to write your solution code and then test your solution.

C++ Specific

  • If you don't set language in config.cfg, default language is C++.
  • If you set C++ as your programming language, when you open editor, a Makefile is created automatically, so after you finish the code, you can use make directly to compile your code.

Controls:

  • Press H to see help information.
  • Press up and down to go through quiz list.
  • Press enter or right to see a quiz detail, and press left to go back.
  • Press R in quiz list view to retrieve quiz from website.
  • Press PageUp or PageDown to go to prev or next page.
  • Press Home or End to go to the first or last quiz.
  • Press f in quiz list view to search quiz by id or title.
  • Press n in quiz list view to search next quiz with search text input before.
    In quiz detail view, press n will always create a new sample code file.
  • Press t in quiz list view to add tag for quiz.
  • Press e in quiz detail view to open editor to edit code.
  • Press d in quiz detail view to open discussion page in web browser.
  • Press S in quiz detail view to open solutions page in web browser.
  • Press s in quiz detail view to submit your code.
  • Press 1 in quiz list view to sort quiz list by id.
  • Press 2 in quiz list view to sort quiz list by title.
  • Press 3 in quiz list view to sort quiz list by acceptance.
  • Press 4 in quiz list view to sort quiz list by difficulty.
    Vim's moving keys h, j, k, l, ctrl+f, ctrl+b are supported.

TODO

  • Test
  • Submit code
  • User login
  • Quiz list sort
  • Install with pip
  • Get quiz default code interface

Contribute

All kinds of contributions are welcome.

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].