Skip to content

When you solve the problem of the Codeforces site, it automatically commits and pushes to the remote repository.

License

Notifications You must be signed in to change notification settings

ISKU/Codeforces-AutoCommit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

When you solve the problem of the Codeforces site, it automatically commits and pushes to the remote repository.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages