A tool to quickly create codeforces contest directories with templates.

Overview

Codeforces Template Tool

I created this tool to help me quickly set up codeforces contests/singular problems with templates.

Tested for windows, should work on linux or any other operating system.

Installation

Clone the repository with git.

git clone [email protected]:com/AnotherTwinkle/cftool.git

Now, navigate to the cftool directory with and install it with pip-

cd cftool
pip install .

Note that Python 3.8 was used to test this script. This should run on 3.4+.

Usage

After installation, the tool should be available anywhere on your CLI. The script has 4 commands you can use.

Creating Singular Files

To create a singular file, use this command-

cftool problem [filename] [?template]

where template is optional. Note that the file name must end with an appropriate language file extension.

For example-

cftool problem 843A.py fastio

The script infers the language from the filename and searches for the template file in the directory templates/{lang}/ directory. Then, it creates a file called [filename]in the current working directory and pastes the template code for you to use.

If the template language directory or the template file doesn't exist, [filename] will be empty on creation.

If you don't provide the template argument, the script will use the default template in the language directory.

Creating a directory for a singular problem

If you'd like to be organized and have invidiual directories for each solution you write, you can use the problemdir command.

cftool problemdir [name] [language] [?template] [?--notes]

Note how you need to explicitly state the language. More precisely, you are telling the script to look for the [language] directory in templates/.

cftool problemdir 433A cpp fastio --notes

This will create a directory called 433A and intialize a file called sol.cpp with the fastio template for C++ in there.

template is still optional. The --notes flag, if provided, will create a file called notes.txt in the directory.

Creating a contest directory

This is peharps the only reason I wrote this script.

cftool contest [name] [language] [problemcount] [?template] [?--notes]

This commands creates a codeforces contest directory. The command syntax is almost simillar to problemdir with the added problemcount argument.

cftool contest 768DivA cpp 6 fastio --notes

This creates a directory called 768DivA and, following codeforces naming scheme, puts 6 files named A, B, C, D, E, F (from A to the problemcount-th letter of the alphabet) respectively. problemcount cannot exceed 26.

The directory name can have multiple words, in that case you put quotes around the name.

cftool contest "696 Div B" py 5 default --notes

This command also supports exclusion of the template argument and --notes flag.

Creating a contest directory with problem directories

This command has the same syntax as contest, but instead of creating files, it creates a directory for each problem, each having a file called sol.

cftool contestwpdir "593 Div 3" cpp 8 fastio --notes

Note: The command name is shorthand for contest with problem directory, this should help you remember the name.

Adding your own templates

If you have a better, or a personal template you'd like to use, you can do so.

First, create a new directory in the templates/ directory of the script. The name of this directory must be the file extension your language uses. i.e py, cpp, js etc. There already are some premade directories.

Next, create a file called default in the directory with your language extension (i.e default.cpp or default.py). This is template used by the script when the template argument is not provided. You can leave this file empty if you want.

Now to add a template, create a file with the desired name (The language extension must be included with filename)

Once you are done, you need to reinstall the script. Navigate to the directory with the setup.py file and run-

pip install .

If all went well you should be able to access the template now, i.e-

cftool problem test.java myshinyjavatemplate

Executable?

I plan making a the script a binary executable in the future, so you don't need python installed to run it.

Contributing

It'd be greatly appreciated if you PR useful templates to the project. If you use the script, consider starring it so more people can find it.

Owner
I like programming, exploring and you.
"Hacking" the (Telekom) Zyxel GPON SFP module (PMG3000-D20B)

"Hacking" the (Telekom) Zyxel GPON SFP module (PMG3000-D20B) The SFP can be sour

Matthias Riegler 52 Jan 03, 2023
Ningyu Jia(nj2459)/Mengyin Ma(mm5937) Call Analysis group project(Group 36)

Group and Section Group 36 Section 001 name and UNI Name UNI Ningyu Jia nj2459 Mengyin Ma mm5937 code explanation Parking.py (1) Calculate the rate of

1 Dec 04, 2021
Python implementation of the Learning Time-Series Shapelets method, that learns a shapelet-based time-series classifier with gradient descent.

shaplets Python implementation of the Learning Time-Series Shapelets method by Josif Grabocka et al., that learns a shapelet-based time-series classif

Mohamed Haseeb 187 Dec 14, 2022
A project to find out all the words in a crossword.

A project to find out all the words in a crossword.

Kalpesh Dhoundiyal 1 Feb 06, 2022
A simply dashboard to view commodities position data based on CFTC reports

commodities-dashboard A simply dashboard to view commodities position data based on CFTC reports This is a python project using Dash and plotly to con

71 Dec 19, 2022
GitHub Actions Version Updater Updates All GitHub Action Versions in a Repository and Creates a Pull Request with the Changes.

GitHub Actions Version Updater GitHub Actions Version Updater is GitHub Action that is used to update other GitHub Actions in a Repository and create

Maksudul Haque 42 Dec 22, 2022
Deis v1, the CoreOS and Docker PaaS: Your PaaS. Your Rules.

This repository (deis/deis) is no longer developed or maintained. The Deis v1 PaaS based on CoreOS Container Linux and Fleet has been replaced by Deis

Deis 6.1k Jan 04, 2023
How to use Microsoft Bing to search for leaks?

Installation In order to install the project, you need install its dependencies: $ pip3 install -r requirements.txt Add your Bing API key to bingKey.t

Ernestas Kardzys 2 Sep 21, 2022
The official Repository wherein newbies into Open Source can Contribute during the Hacktoberfest 2021

Hacktoberfest 2021 Get Started With your first Contrinution/Pull Request : Fork/Copy the repo by clicking the right most button on top of the page. Go

HacOkars 25 Aug 20, 2022
Painel simples com consulta de cep,CNPJ,placa e ip

Painel mpm Um painel simples com consultas de IP, CNPJ, CEP, PLACA, TELEFONE, CPF e NOME Início 🌐 apt update && apt upgrade -y pkg i python git pip i

8 Feb 27, 2022
Q-Tracker is originally a High School Project created by Admins of Cirus Lab.

Q-Tracker is originally a High School Project created by Admins of Cirus Lab. It's completly coded in python along with mysql.(Tkinter For GUI)

Adithya Krishnan 2 Nov 14, 2022
ICEtool - ICEtool plugin for QGIS

ICEtool ICEtool is an all in one QGIS plugin to easily compute ground temperatur

Arthur Evrard 13 Dec 16, 2022
⚙️ Compile, Read and update your .conf file in python

⚙️ Compile, Read and update your .conf file in python

Reece Harris 2 Aug 15, 2022
Allows you to purge all reply comments left by a user on a YouTube channel or video.

YouTube Spammer Purge Allows you to purge all reply comments left by a user on a YouTube channel or video. Purpose Recently, there has been a massive

4.3k Jan 09, 2023
Wrappers around the most common maya.cmds and maya.api use cases

Maya FunctionSet (maya_fn) A package that decompose core maya.cmds and maya.api features to a set of simple functions. Tests The recommended approach

Ryan Porter 9 Mar 12, 2022
A tool to improve Boolean satisfiability (SAT) solver user's life

SatHelper This is a tool to improve the Boolean satisfiability (SAT) and MaxSAT solver user's life. It helps you model various problems as SAT and Max

Tomas Balyo 1 Nov 16, 2021
The dynamic code loading framework used in LocalStack

localstack-plugin-loader localstack-plugin-loader is the dynamic code loading framework used in LocalStack. Install pip install localstack-plugin-load

LocalStack 5 Oct 09, 2022
Python Repository for Bachelor Ski Sign.

BachelorSkiSign Python Repository for Bachelor Ski Sign. This application reads data from https://bachelorapi.azurewebsites.net/ It is written in Ciru

Winston 1 Jan 04, 2022
pgvector support for Python

pgvector-python pgvector support for Python Great for online recommendations 🎉 Supports Django, SQLAlchemy, Psycopg 2, Psycopg 3, and asyncpg Install

Andrew Kane 37 Dec 20, 2022
Python Project For Beginner

Basic-Vitrual-AI-Assistant Python Project For Beginner Hey There, I had manipulated Selenium WebDriver to make this assistant. I hope, It will be help

Maruf Billah 13 Dec 12, 2022