Quick templates script for codeforces contests.

Related tags

Miscellaneous cftool
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 git@github: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.

You might also like...
Templates for creating rust projects with a GitHub-managed lifecycle with cargo-generate 🏗️📃

rust-templates Templates for creating rust projects with a GitHub-managed lifecycle with cargo-generate. 🏗️ 📃 What you get: PR build validation usin

Cookiecutter templates for Serverless applications using AWS SAM and the Rust programming language.

Cookiecutter SAM template for Lambda functions in Rust This is a Cookiecutter template to create a serverless application based on the Serverless Appl

The simplest build-time framework for writing web apps with html templates and typescript

Encoped A build-time fast af tool to write static apps with html and TypeScript Features Template-based ESLint, Prettier and Rollup integration No ext

Here are a few cargo-generate templates for use when creating bevy applications
Here are a few cargo-generate templates for use when creating bevy applications

Bevy-template-rs Here are a few cargo-generate templates for use when creating bevy applications. Templates Game This is a template for starting a new

Compiled string templates for Rust

templariusz Compiled string templates for Rust Usage See tests for detailed usage examples Basic example use templariusz::{template, Template}; #[tem

YAML(ish) - Terminal UI framework based on templates focused on simplicity
YAML(ish) - Terminal UI framework based on templates focused on simplicity

A YAML(ish) based terminal GUI framework for- and by Rust, focussed on making it quick and easy to create a functional UI for an app or game. Based on Crossterm and inspired by Kivy.

⚙️ A cute .gitignore generator with support for custom templates
⚙️ A cute .gitignore generator with support for custom templates

Gign A Gitignore Generator Table of Contents Examples Install Custom templates Help Examples # This is how you going to use it probably most of the ti

Core Fiberplane data models and methods for transforming them (templates, providers, markdown conversion)

fiberplane This repository is a monorepo for Rust code that is used throughout Fiberplane's product. Overview base64uuid - A utility for working with

tmplt is a command-line interface tool that allows you to quickly and easily set up project templates for various programming languages and frameworks
tmplt is a command-line interface tool that allows you to quickly and easily set up project templates for various programming languages and frameworks

tmplt A User Friendly CLI Tool For Creating New Projects With Templates About tmplt is a command-line tool that lets users quickly create new projects

🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀
🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀

Backpack A tool to curate and automate your starter projects Key Features • How To Use • Download • Contributing • License Key Features Generate from

SKYULL is a command-line interface (CLI) in development that creates REST API project structure templates with the aim of making it easy and fast to start a new project.

SKYULL is a command-line interface (CLI) in development that creates REST API project structure templates with the aim of making it easy and fast to start a new project. With just a few primary configurations, such as project name, you can get started quickly.

Web scraper written in Rust for extracting paid HTML templates for free.

HTML Template Scraper This tool provides a convenient solution by allowing you to access and download a wide range of HTML website templates, includin

Create `.gitignore` files using one or more templates from TopTal, GitHub or your own collection
Create `.gitignore` files using one or more templates from TopTal, GitHub or your own collection

gitnr A cross-platform CLI utility to create .gitignore files using templates. Use templates from the GitHub & TopTal collections Use local files and

Better touch. Efficient file creation with templates.

touchx Better touch. Efficient file creation with templates. If you save files such as LICENSE or .editorconfig, you can create files with similar con

QML (Qt Quick) bindings for Rust language

QML-rust - bindings for Qt Quick Bindings are based on DOtherSide C bindings for QML Library is mostly feature-compliant with other bindings based on

A quick and dirty Space Invaders type game in Bevy, with attached tutorial.

This article is in-development and will be released in full form soon. It'll appear on Medium (my publisher likes that), with this as a the accompanyi

🧹 Quick & dirty fuzzy path comparison

🧹 fuzzypath Quick & dirty fuzzy path comparison Comparison rules ✅ Case insensitive ✅ Backslashes are normalized to forward slashes ✅ Trailing slashe

Scrypto Advent Calendar. Learn the new programming langage to build quick and secure DeFi applications.

Scrypto Advent Calendar I am publishing new Christmas related Scrypto examples every day from Dec 1st to Dec 25th. "Watch" this project to get notifie

Quick'n dirty macro set for advent of code 2021

AOC quick'n dirty macro set Those are implemented using quick'n dirty procedural macros and libraries. Running the program Use cargo run --release --

Owner
I like programming, exploring and you.
null
qn (quick note) is a simple, fast and user-friendly way to save notes 🦀⚙️

Quick Note qn Install This is currently for my personal use. I may push breaking changes at any time. If you want to use it, bring down the code and r

Code Smell 3 Jul 15, 2022
Submit sbatch jobs without the need to create a script

ssubmit Submit sbatch jobs without having to create a submission script Motivation Install Usage Motivation This project is motivated by the fact that

Michael Hall 44 Nov 23, 2022
A little command-line script written in Rust to interface with Discord webhooks.

Rust Discord Webhook Agent This is a little "script" I wrote for practice with Rust and asynchronous operations within Rust. Getting started Clone thi

David Chen 2 Sep 7, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Yet another Codeforces cli

cf-tool-rs A Rust implement for https://github.com/xalanq/cf-tool WIP. Pull Requests / Contributions are welcomed! How to Configure? Configure File sh

Woshiluo Luo 2 May 8, 2022
:pencil: Compile-time HTML templates for Rust

maud Documentation (source) • API reference • Change log Maud is an HTML template engine for Rust. It's implemented as a macro, html!, which compiles

Chris Wong 1.4k Jan 1, 2023
Rust Compiled Templates with static-file handling

Rust Compiled Templates — ructe This is my attempt at writing a HTML template system for Rust. Some inspiration comes from the scala template system u

Rasmus Kaj 337 Jan 8, 2023
Type-safe, compiled Jinja-like templates for Rust

Askama Askama implements a template rendering engine based on Jinja. It generates Rust code from your templates at compile time based on a user-define

Dirkjan Ochtman 2k Jan 5, 2023
Quickly create boilerplate projects and templates.

boyl boyl is a command-line tool written in Rust to manage template folders. boyl can copy existing folders (with support for glob-like ignore pattern

Miguel M. 13 Feb 16, 2022
📦 Transpile readable code into DiamondFire templates

Welcome to fudge ?? ?? Transpile readable code into DiamondFire templates Author ?? BumpyBill & DADp Show your support Give a ⭐️ if this project helpe

null 6 Jan 25, 2022