Giter Site home page Giter Site logo

m-s-abeer / vjudge-to-oj Goto Github PK

View Code? Open in Web Editor NEW
55.0 2.0 10.0 736 KB

Import your vJudge solutions to actual online judges. Currently supports UVa, CodeForces, SPOJ, and CodeForces GYM.

License: MIT License

Python 98.32% Shell 1.68%
vjudge uva codeforces competitive-programming spoj codeforces-gym vjudge-solutions python

vjudge-to-oj's Introduction

vjudge-to-oj

made-with-python GitHub license GitHub forks GitHub stars Hits

Competitive programmers spend hundreds and thousands of hours practicing programming problems and participating contests. Vjudge has been an amazing platform for participating/hosting programming contests and problem-solving.

However, there can be scenarios where you'd like to add vjudge solutions to the actual judge profiles specifically. I personally felt the need of it along with some of my friends and colleagues. It's a tiresome job to submit all the solved problems of vjudge to the actual judges. This here is a small approach to get such works done easily.

Current solution will only work for UVa, CodeForces, LightOj and SPOJ. So far, it's pretty much stable and working just fine. It's roughly written and tested. But hey, it works!!!

With enough response and your contribution I hope to add some more judges here as well. Huge thanks to all who contributed so far to my fun projects.

Let me know if you have any questions/suggestions/feedbacks or simply if you liked it.

Email: [email protected]

Hope you enjoy. <3


Installation Guide:

With poetry(Easier):-

  1. Download/clone the repository from github using git:-
    • Run git clone https://github.com/m-s-abeer/vjudge-to-oj.git from your cmd/terminal in your specified directory.
  2. Download and install python ^3.10 from here:- https://www.python.org/downloads/
  3. Make sure you are using the desired python version by running python --version
  4. Download and install python-poetry
  5. Get inside project vjudge-to-oj and then write poetry install on cmd/terminal. This should install all the dependencies/packages.

Without poetry:-

  1. Download/clone the repository from github using git:-
    • Run git clone https://github.com/m-s-abeer/vjudge-to-oj.git from your cmd/terminal in your specified directory.
  2. Download and install python ^3.10 from here:- https://www.python.org/downloads/
  3. Make sure you are using the desired python version by running python --version
  4. Get inside project vjudge-to-oj
  5. Write python -m venv .venv to create a python environment inside project.
  6. Write source ./.venv/activate for Linux, MacOS, WSL. For windows write .\.venv\Scripts\activate to activate the python environment
  7. Run pip install --upgrade pip and then pip install -r requirements.txt to install all the dependencies/packages

Set your .env file:-

  1. Create a file named .env in the project directory.
  2. Copy the contents of .env.example and paste it in .env file.
  3. Read the comments in .env file and set the values accordingly.

How it should work:

  1. Complete the #installation-guide and run the following command inside project root from cmd/terminal to activate the environment:-
    • Poetry users: poetry shell
    • Linux, MacOS, WSL users: source ./.venv/bin/activate
    • Windows users: .\.venv\Scripts\activate
  2. Make sure you have set the values in .env file correctly.
  3. Run python main.py from the project root
  4. The program will automatically download your Accepted solutions from vjudge and then submit them one by one and store the submitted solutions to another folder(modules>Submitted>UVA>).
  5. It'll show you the status report as it runs. It may look messy, but it actually helps you see what's going on.
  • No login data is bypassed/redirected to anywhere else. Vjudge login data is stored inside "vjudge-to-oj>modules>cookies" this directory. You can empty that folder if you're concerned or have issues logging in.

N.B: Please don't run it when the corresponding judge is already busy and many submissions are already in queue. It's built only for personal uses. This program is in no way meant to hamper the solving environment of a judging platform.

vjudge-to-oj's People

Contributors

99mominur avatar dependabot[bot] avatar m-s-abeer avatar sazidnur avatar trswnca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vjudge-to-oj's Issues

Use .env for credential inputs instead of main.py

In the current solution, we're updating main.py directly to insert raw credentials. Not good! It requires you to clean it up before taking the latest pull and the credentials shouldn't be put into an actual source code file.

The next approach is going to be:-

  1. There will be an env.example file containing credential format and if the profile will be used actively for the next run.
  2. The user will copy the env.example to .env file and insert their credentials there.
  3. Running the main function will use .env to determine which profiles to use and collect credentials from .env for submission.

This can also be improved in the future, depending on the demand. Leave a comment if you think we should take a different path.

Wrong extensionId on codeforces

Message here:

Trying Problem: 1210A - Anadi and Domino, 0
Traceback (most recent call last):
  File "/home/cyc/Downloads/vjudge-to-oj-master/main.py", line 45, in <module>
    cfUser.submitAll(submitSolvedOnes = False, limitSubmissionCount = 10)
  File "/home/cyc/Downloads/vjudge-to-oj-master/modules/judges.py", line 379, in submitAll
    sid = str(self.submitSolution(solve))
  File "/home/cyc/Downloads/vjudge-to-oj-master/modules/judges.py", line 402, in submitSolution
    self.br.form.find_control(name="programTypeId").value = [self.extentionId[solution.solutionExt]]
  File "/home/cyc/.local/lib/python3.9/site-packages/mechanize/_form_controls.py", line 1130, in __setattr__
    self._set_value(value)
  File "/home/cyc/.local/lib/python3.9/site-packages/mechanize/_form_controls.py", line 1149, in _set_value
    self._single_set_value(value)
  File "/home/cyc/.local/lib/python3.9/site-packages/mechanize/_form_controls.py", line 1172, in _single_set_value
    on, off = self._get_items(value[0])
  File "/home/cyc/.local/lib/python3.9/site-packages/mechanize/_form_controls.py", line 1156, in _get_items
    raise ItemNotFoundError("insufficient items with name %r" %
mechanize._form_controls.ItemNotFoundError: insufficient items with name '42'

thought that was the extensionID error.

Vjudge login issue

I ran with & without editing the .env file with VJ usr & pass but still getting this:
image

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.