repo zipper

Have you ever needed to zip a git repository? Well, this is fairly simple with git git archive --format zip --output <output_path> HEAD But what about if you need to zip multiple repositories at once? This might get tedious. Bash scripting to the rescue Worry no more! Create a repoZipper.sh file with the following content #!/bin/bash # Set the name of the output archive file OUTPUT_ARCHIVE="repos.zip" # Create a temporary directory to store the cloned repositories TEMP_DIR=$(mktemp -d) echo "Working temporary directory: ${TEMP_DIR}" # Loop through each repository URL passed as input while read -r REPO_URL do # Extract the repository name from the URL REPO_NAME=$(echo "${REPO_URL}" | cut -d'/' -f2) # Clone the repository git clone "${REPO_URL}" "${TEMP_DIR}/${REPO_NAME}" # Create a zip archive of the repository pushd "${TEMP_DIR}/${REPO_NAME}" || exit git archive --format=zip --output="${TEMP_DIR}/${REPO_NAME}.zip" HEAD popd || exit done # Combine all individual repos into one archive pushd "${TEMP_DIR}" || exit zip -r "${OUTPUT_ARCHIVE}" ./*.zip popd || exit # Move the output archive to the current directory mv "${TEMP_DIR}/${OUTPUT_ARCHIVE}" . # Remove the temporary directory rm -rf "${TEMP_DIR}" Then create a file repos.txt with the list of repositories to zip ...

Die Agony

Introduction This is the solution for the December 2022’s Jane Street puzzle. Check out the original post on the Jane Street website. The Puzzle A six-sided die, with numbers written on each of its faces, is placed on the 6-by-6 grid above, in the lower-left (yellow) corner. It then makes a sequence of “moves”. Each move consists of tipping the die into an orthogonally adjacent square within the grid. ...

Pent-up Frustration 2

Introduction This is the solution of the November’s Jane Street puzzle. It involves pentagons, patience and a lot of computation. Check out the original post on the Jane Street website. The Puzzle The scope of this puzzle is to find the minimum distance between two pentagons arranged in a polyform. You have seventeen identical unit regular pentagonal tiles on a tabletop. You arrange them all into a single polyform, so each pentagon placed after the first shares a side with an already-placed pentagon, but no two pentagons overlap other than along their boundaries. What is the smallest nonzero distance you can create between two of the pentagons? ...

Jane Street Puzzles

I recently discovered the website Jane Street. They are a quantitative trading firm that hires people with a strong mathematical background. They also publish monthly challenges in the form of puzzles. If you solve the puzzle, you can submit your solution and if correct, they will publish your name on the puzzle’s page. The first one I tackled was Pent-up Frustration 2. I also publish the code on GitHub (once the solution is out). ...

About this site

This site is built using Hugo, a very fast static site generator built in golang that translates markdown files into websites. Theme The base theme I am using is PaperMod but I heavily modified it to fit my needs. Link Checker To make sure all the links are working, I use hydra. This runs as a Github Action and scrapes the website for broken links. Source Code You can take a look at the source code on GitHub ...