Giter Site home page Giter Site logo

syuya2036 / atcoder-rust-devcontainer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yiwiy9/atcoder-rust-devcontainer

0.0 0.0 0.0 83 KB

This is a repository that provides a development environment for Rust programming language, pre-configured with tools and settings optimized for participating in AtCoder competitions.

License: Apache License 2.0

Shell 87.79% Dockerfile 12.21%

atcoder-rust-devcontainer's Introduction

๐Ÿ†๐Ÿฆ€ AtCoder Rust Devcontainer

CI License: MIT OR Apache-2.0

๐ŸŒ Overview

The atcoder-rust-devcontainer repository offers a tailored development environment for competitive programming in the Rust language, specifically for AtCoder contests. Utilizing a devcontainer setup, it simplifies the task of setting up and diving straight into coding challenges without the usual overhead of environment configuration.

๐Ÿš€ Key Features, Benefits, and Available Tools

  • ๐Ÿ”ง Integrated Toolset: Equip yourself with general Rust tools like rust-analyzer, rustfmt, clippy, and the VS Code-specific debugger vscode-lldb. For competitive programming, this environment also integrates cargo-compete and cargo-snippet.

  • ๐ŸŒŸ Hassle-Free Setup: Bypass the tedious process of setting up tools individually. Jump directly into competitive programming with everything set up for you.

  • ๐Ÿ” Optimized for Rust: This devcontainer is fine-tuned for Rust, offering features such as auto-formatting, linting, and debugging for a smooth coding experience.

  • ๐Ÿ“ฆ Quick Code Snippets: Leverage the integrated cargo-snippet to create and utilize Rust code snippets effortlessly in Visual Studio Code.

๐Ÿ›  Prerequisites

๐Ÿšถ Getting Started

๐Ÿ“‹ Setting Up Your Environment:

  • Copy the .devcontainer/.env.example file to .devcontainer/.env.
  • Inside the .devcontainer/.env file, make sure to set the following:
    • ATCODER_USERNAME: Replace with your AtCoder username.
    • ATCODER_PASSWORD: Replace with your AtCoder password.

After updating the values, you'll need to rebuild the devcontainer for the changes to take effect.

By configuring these values correctly, the devcontainer will be able to automatically sign you into the AtCoder platform upon successful rebuild.

๐Ÿ”‘ Key Files and Usage

entrypoint.sh ๐Ÿ“„

This script initializes the development environment:

  1. ๐Ÿ–‡ Copies the example VS Code settings file for rust-analyzer to the appropriate location, if it doesn't already exist.
  2. ๐Ÿ“ Generates Rust code snippets using cargo_snippet.sh.
  3. ๐Ÿ”’ Automatically signs in to the AtCoder website with the provided username and password.

cargo_compete_new.sh ๐Ÿ“‚

This script sets up a new contest directory and updates the rust-analyzer configuration in the VS Code settings.

๐Ÿš€ Usage

  1. ๐Ÿ–ฅ Open the terminal within the devcontainer.
  2. โ–ถ Run cargo_compete_new.sh <contest> where <contest> is the contest's name.

create_gitkeep_in_testcases.sh ๐Ÿ“‚

This script is a workaround for the issue detailed in qryxip/cargo-compete#198. It automates the creation of .gitkeep files within the in/out directories of the cargo compete testcases, ensuring that these directories are tracked by Git even if they are empty.

๐Ÿš€ Usage

  1. ๐Ÿ–ฅ Open the terminal within the devcontainer.
  2. โ–ถ Run the script by typing create_gitkeep_in_testcases.sh <path_to_contest_directory>.

The script will iterate over all .yml files in the <path_to_contest_directory>/testcases directory and ensure that each corresponding in/out directory has a .gitkeep file.

๐Ÿ“ Note:

  • When you execute cargo_compete_new.sh, the create_gitkeep_in_testcases.sh script is automatically run for the new contest directory.
  • If you're using cargo compete add to add problems, you'll need to run create_gitkeep_in_testcases.sh manually for the specific contest directory.

cargo_snippet.sh ๐Ÿ–‡

This script generates Rust code snippets for Visual Studio Code, tailored for competitive programming. It allows you to create custom snippets in the src/lib directory and make them available for use within Visual Studio Code.

๐Ÿš€ Usage

  1. ๐Ÿ–ฅ Open the terminal within the devcontainer.
  2. โ–ถ Run the script by typing cargo_snippet.sh.

This updates the rust.code-snippets file in the .vscode directory, making your custom snippets available in Visual Studio Code.

๐Ÿ›  Usage Examples

๐Ÿ Setting up and Solving Problems (e.g., AtCoder Beginner Contest 317)

  1. ๐Ÿ“ Create a new contest directory:
    • cargo_compete_new.sh abc317
  2. ๐Ÿšถ Navigate to the created directory:
    • cd $WORKSPACE_FOLDER/src/contest/abc317/
  3. ๐Ÿ“ Solving a Problem (e.g., Problem A):
    • ๐Ÿงช Execute sample test cases: cargo compete test a
    • ๐Ÿ“ค Submit your solution: cargo compete submit a

๐ŸŽฏ Solving a Specific Problem (e.g., ABC317 problem a)

  1. ๐Ÿšถ Navigate to your preferred directory:
    • cd $WORKSPACE_FOLDER/src/{your_directory_of_choice}
  2. โž• Add the desired problem:
    • cargo compete add abc317_a
  3. ๐Ÿงช Execute sample test cases:
    • cargo compete test abc317_a
  4. ๐Ÿ“ค Submit your solution:
    • cargo compete submit abc317_a

๐Ÿ“œ License

This project is dual-licensed under MIT or Apache-2.0. For more details, see LICENSE-MIT and LICENSE-APACHE.

atcoder-rust-devcontainer's People

Contributors

yiwiy9 avatar

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.