Command Line Based Tool for uva onlinejudge with features Submitting and uHunting.
- Command line based tool
curl
nlohmann json
C++ library
General installation process is only available for Linux operating system, Windows version is coming soon. But now, you can use this tool in windows by changing some lines of source code.
- Install
curl
: Download and install curl (website: https://curl.haxx.se/). On ubuntu to install curl execute
sudo apt install curl
- Download uva-tool: Execute command
git clone https://github.com/arafat-hasan/uva-tool.git
- Install uva-tool: In the downloaded folder
uva-tool
, look forinstall.sh
file and execute it (C++ compiler needed here, GNU g++ used in testing).
chmod +x install.sh
./install.sh
Your system may not able to use getlogin()
function which is used in src/uva-tool.cpp
file for szHome
constant. In that case set szHome
constant to your operating system's username.
Get you login username using command whoami
or echo $USERNAME
.
Now set szHome const
const string szHome = "username";
Run corresponding commands
- Login:
uva-tool -login
- Logout:
uva-tool -logout
- Hunt:
uva-tool -hunt -u felix_halim -r 10
This will show last 10 submissions of userfelix_halim
- Submit: Syntax
uva-tool -submit problem_number problem_path language
Exampleuva-tool -submit 100 ~/Desktop/100.cpp 5
This will submit100.cpp
named file from Desktop directory in C++11 (5 for C++11) language with problem number 100.
Note: Language codes 1 for ANSI, 2 for JAVA, 3 for C++, 4 for Pascal, 5 for C++11, 6 for Python.
Copy vim_uva-tool_run_script.sh
file to your .vim directory and add this lines to .vimrc file
map <leader>uvw :!clear && uva-tool -hunt -u felix_halim -r 10
map <leader>uvs :!clear && ~/.vim/vim_uva-tool_run_script.sh '%:p'<CR>
map <leader>uvi :!uva-tool -login
map <leader>uvo :!uva-tool -logout
Keyboard mappings
\uvs
to submit
\uvw
to hunt
\uvi
to login
\uvo
to logout
Copy geany_uva-tool_run_script.sh
file to /home/$USER/.config/geany/uva-tool
directory and run command chmod +x geany_uva-tool_run_script.sh
.
Now in geany (open a file i.e a cpp file first), go to Build -> Set Build Commands, a window opens. In Execute commands section at no 2, set this Command, Working directory and Label
Command: ./geany_uva-tool_run_script.sh '%f' '%d'
Working directory: /home/$USER/.config/geany/uva-tool
Label: uva-tool
Now all set.
Click on Build -> uva-tool for submitting, huntting etc.
It's not a good idea to run a script in command execution section of geany for running uva-tool instead of writing a geany plugin, but a easy good hack. And I have no plan to write a geany plugin for that in future. Anyone who interested, warmly welcomed with MIT licenses.
- Bring Windows version
- Show user statistics in hunting
- Use a C++ networking library instead of cURL
- Make command line options more dynamic