Giter Club home page Giter Club logo

codeforces-autocommit's Introduction

Codeforces-AutoCommit

Codeforces-AutoCommit is a tool that solves various algorithmic problems in Codeforces and automatically pushes source code to remote repositories such as Github if you get the correct answer. This tool uses your handle to search and analyze the source code in Codeforces. If the source code does not exist in your local repository, download the source code and save it to your local repository and use Git to automatically add, commit, and push to the remote repository.

Installation

$ git clone https://github.com/ISKU/Codeforces-AutoCommit

Dependency

$ pip3 install requests
$ pip3 install bs4

How to use

  • If you do not want to enter user information every time you run the tool, create info.json as in the following example:
{
	"handle": "my_codeforces_handle",
	"git_id": "my_github_id",
	"git_pw": "my_github_password",
	"remote_url": "https://github.com/ISKU/Algorithm"
}
  • Make sure to enter the user information correctly when running the tool or in info.json. Then run the tool as follows.
$ python3 main.py
  • This tool has a very long wait time. It is recommended to run in Background as follows.
$ nohup python3 main.py &

Default

  • Commit message is "Add solution for [contest_id][problem_index]".
  • Create a directory named [contest_id] and save the source code file named [problem_index] in that directory.
  • Search the source code every 10 minutes.
  • Search all submitted source code and analyze the correct source code.
  • If there are multiple correct source codes, select the last submitted source code.

Extension

  • You can freely manage your own remote repositories by extending the tool.
  • In the option.json file, enter the options you want, as in the following example:
{
	"commit_message": "Add for [CONTEST][INDEX] [TITLE]",
	"source_tree": "Algorithm/Codeforces/src",
	"mkdir": true,
	"dir_name": "[CONTEST]",
	"source_name": "[INDEX]",
	"poll": 600,
	"lang": "GNU C++17"
}

๐Ÿ’ก Unused options must be cleared.


Key Options:

Key Description
commit_message Set the commit message.
source_tree Save the source code in that path. (The starting directory must match the repository name.)
mkdir Decide if you want to create a directory when you save the source code.
(false: dir_name option is ignored.)
dir_name Set the name of the directory where the source code is saved.
source_name Set the name of the source code file.
poll Set the source code search cycle in seconds in Codeforces.
lang Only the languages you submit in that language will be pushed.

๐Ÿ’ก [CONTEST]: If the content contains [CONTEST], it is replaced by contest_id.
๐Ÿ’ก [INDEX]: If the content contains [INDEX], it is replaced by problem_index.
๐Ÿ’ก [TITLE]: If the content contains [TITLE], it is replaced by problem_title.

Example

{
	"commit_message": "Codeforces #[CONTEST][INDEX]: [TITLE]",
	"source_tree": "Algorithm/Codeforces",
	"mkdir": true,
	"dir_name": "[CONTEST]",
	"source_name": "[INDEX]",
	"poll": 600,
	"lang": "Java 8"
}

License

Author

codeforces-autocommit's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.