Skip to content

Instantly share code, notes, and snippets.

@somian
Created October 12, 2025 01:39
Show Gist options
  • Select an option

  • Save somian/6ca29d52a710d81182023679c67f845d to your computer and use it in GitHub Desktop.

Select an option

Save somian/6ca29d52a710d81182023679c67f845d to your computer and use it in GitHub Desktop.
*sh Script for determining fastest mirror for downloading LMDE ISOs
#!/bin/bash
# Last modified: Sat Oct 11 2025 12:39:33 PM -04:00 [EDT]
# List of potential LMDE mirror base URLs. /-* World & US mirrors *-/
MIRROR_LIST=(
"https://mirrors.cicku.me/linuxmint/iso/debian/"
"https://pub.linuxmint.io/debian/"
"https://mirror.rackspace.com/linuxmint/iso/debian/"
"https://mirror.clarkson.edu/linuxmint-images/debian/"
"https://mirror.fcix.net/linuxmint-images/debian/"
"https://mirrors.gigenet.com/linuxmint/iso/debian/"
"https://mirrors.seas.harvard.edu/linuxmint/debian/"
"https://mirror.hoobly.com/linuxmint-iso/debian/"
"https://mirror.cs.jmu.edu/pub/linuxmint/images/debian/"
"https://mirrors.kernel.org/linuxmint/debian/"
"https://mirrors.iu13.net/linuxmint/iso/debian/"
"https://mirror.us.mirhosting.net/linuxmint/debian/"
"https://mirrors.ocf.berkeley.edu/linux-mint/debian/"
"https://plug-mirror.rcac.purdue.edu/mint-images/debian/"
"https://mirrors.sonic.net/mint/isos/debian/"
"https://mirror.team-cymru.com/mint/debian/"
"https://mirror.pit.teraswitch.com/linuxmint-iso/debian/"
"https://mirrors.usinternet.com/mint/images/linuxmint.com/debian/"
"https://mirrors.xmission.com/linuxmint/iso/debian/"
)
ISO_FILENAME="lmde-6-cinnamon-64bit.iso"
echo "Testing LMDE ISO download speeds from various mirrors..."
echo "------------------------------------------------------"
BEST_SPEED=999999999 # Initialize with a very high value
FASTEST_MIRROR=""
for MIRROR_BASE_URL in "${MIRROR_LIST[@]}"; do
FULL_ISO_URL="${MIRROR_BASE_URL}${ISO_FILENAME}"
echo "Testing: ${FULL_ISO_URL}"
# Use wget to download a small portion of the file and measure speed.
# -q: quiet, --spider: don't download, just check existence, --timeout=10: timeout after 10 seconds
# If using for actual download speed, replace --spider with -O /dev/null and parse speed from output
# For a more robust speed test, you would actually download a small file
# and calculate the speed. Here, we're simulating a speed test by looking at connection time.
# A more accurate way to test download speed is to actually download a small, known-size file
# and measure the time it takes. For example:
START_TIME=$(date +%s.%N)
wget -q --spider --timeout=10 "${FULL_ISO_URL}" > /dev/null 2>&1
if [ $? -eq 0 ]; then
# If the file exists, attempt a partial download to measure speed
curl --progress-bar --range 1-4096 --output /dev/null --connect-timeout 12 "${FULL_ISO_URL}"
END_TIME=$(date +%s.%N)
DURATION=$(echo "$END_TIME - $START_TIME" | bc)
# This is a simplified speed metric. A more accurate calculation would involve
# downloading a specific file size and calculating MB/s.
# For simplicity, we are using the duration of a partial download attempt.
if (( $(echo "$DURATION < $BEST_SPEED" | bc -l) )); then
BEST_SPEED=$DURATION
FASTEST_MIRROR=$MIRROR_BASE_URL
fi
echo " - Connection/partial download time: ${DURATION} seconds"
else
echo " - Could not reach or find the ISO at this mirror."
fi
echo ""
done
echo "------------------------------------------------------"
if [ -n "$FASTEST_MIRROR" ]; then
echo "Fastest mirror found: ${FASTEST_MIRROR}"
echo "Estimated time: ${BEST_SPEED} seconds"
echo "You can download the ISO from: ${FASTEST_MIRROR}${ISO_FILENAME}"
else
echo "No reachable mirrors found or tested."
fi
# --------------------------------------------------------- #
# Found on Gemini (Google web search AI), modified by Soren
# Andersen to use curl partial-download, as wget doesn't seem
# to do that.
# --------------------------------------------------------- #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment