Skip to content

PyBites-Open-Source/pybites_rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pybites_rust

Exercise downloader

Exercise downloader for https://rustplatform.com/

Quickstart

  • install the exercise downloader, open a terminal and run:
    cargo install pybites-rust-download
  • cd to the directory where you want to save the exercises
  • run the downloader (free exercises only):
    pybites-rust-download
  • to download all exercises (requires premium), set your API key:
    PYBITES_API_KEY=your-api-key-here pybites-rust-download
    Or export it in your shell profile so you don't have to pass it every time:
    export PYBITES_API_KEY=your-api-key-here
    You can find your API key on your profile page.

Navigating exercises

Once downloaded, use fzf to quickly jump between exercise directories:

cdf() {
  local dir
  dir=$(find . -type d | fzf --reverse --prompt='cd to> ') || return
  cd "$dir"
}

Add this to your shell profile, then type cdf to fuzzy-search and cd into any exercise.

Compile it manually

Maybe you want to have a look at the code and make some changes.

  • clone the repo and cd to the main directory of the project
  • compile the downloader
    cd exercise_downloader && \
        cargo build --release
  • cd back to the project main directory
    cd ..
  • run the downloader from the project main directory
    ./exercise_downloader/target/release/pybites-rust-download
  • the downloader will create exercises in the current directory

Makefile

Alternatively, use the Makefile. Be aware that this will create exercises in the project main directory, where the Makefile is located.

make download-exercises

Examples

(Open to see some output examples ...)

Using cargo to install from crates.io.

➜ cargo install pybites-rust-download
  Installing pybites-rust-download v0.1.4

(...)

   Compiling pybites-rust-download v0.1.4
    Finished `release` profile [optimized] target(s) in 15.61s
  Installing /my/home/.cargo/bin/pybites-rust-download
   Installed package `pybites-rust-download v0.1.4` (executable `pybites-rust-download`)

➜

Using make to compile and execute the exercise downloader.

➜ make download-exercises
make build-executable && \
exercise_downloader/target/release/pybites-rust-download && \
echo ... all done
make[1]: Entering directory '/my/home/github/pybites_rust'
cd exercise_downloader && \
cargo build --release
    Finished `release` profile [optimized] target(s) in 0.06s
make[1]: Leaving directory '/my/home/github/pybites_rust'
Downloading the exercises from Pybites Rust (rustplatform.com) ✅
'exercises' will be created in the current directory (/my/home/github/pybites_rust/exercises)
21 exercises found!

"Strings and Slices""URL Query Parameter Parser""Hello Rustacean""Vectors and Vec""Variables and Mutability""Json Serialization""Simple Calculations""Working with Enums""Vowel Counter""Using Structs in Rust""Fibonacci Sequence""Primitive Types""Basic Tokenizer""Reverse a String""Variable Assigment and Mutability""Ownership and Borrowing""Scopes and Shadowing""Function Return Values""Result Handling""Basic Struct""Control Flow" ✅
... all done

Credits

Originally created by Giuseppe Cunsolo.

About

Download the Pybites Rust exercises - https://rustplatform.com/

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •