Three Small Shell Scripts That Make HackerRank/DevSkiller C++ Take-Homes Way Less Painful
If you've ever done a timed C++ coding assessment on a platform like HackerRank or DevSkiller, you know the friction isn't really the algorithm — it's the loop . Download a zip with a weird filename, unzip it, hunt for the project root, configure CMake, build, run GTest, fix one failing test, repeat... and somewhere in there you've burned ten minutes of your one-hour window just fighting the harness instead of writing code. These platforms' in-browser editors are fine for quick problems, but for anything involving multiple files (headers, sources, a real test suite), I'd rather work in my own terminal and editor. The catch is that you still have to get the project out of the browser sandbox, build it locally with the exact same toolchain (CMake + GTest), and then package it back up in a way the grader will accept. So I wrote three small bash scripts to remove that friction entirely. Sharing them here in case they save someone else the same ten minutes. The workflow Download the project archive from the platform (zip or tar.gz, filename is whatever the platform gives you — often randomized) Extract it — script 1 handles this regardless of filename or archive type Iterate — script 2 configures CMake once, then repeatedly builds and runs GTest, optionally watching for file changes Package — script 3 strips build artifacts and any local helper scripts, then zips it back up under a name that won't collide with the original download, ready to re-upload Script 1: extract_and_setup.sh Most of these platforms hand you an archive with an unpredictable filename. This script extracts whatever you point it at ( .tar , .tgz , .tar.gz , or .zip ), figures out which directory it unpacked to by diffing the folder listing before and after, and drops the build script into it automatically. #!/usr/bin/env bash # extract_and_setup.sh # Extracts $fname (tar, tgz, tar.gz, or zip) into the CURRENT folder, # then copies run_build.sh into the directory that was created. # # Usage: # ./extrac