Skip to content

Instantly share code, notes, and snippets.

@robvanoostenrijk
Created December 29, 2022 04:51
Show Gist options
  • Save robvanoostenrijk/2d51a15eae0c3d6343c7244d5e672d2a to your computer and use it in GitHub Desktop.
Save robvanoostenrijk/2d51a15eae0c3d6343c7244d5e672d2a to your computer and use it in GitHub Desktop.
Determine fastest Alpine mirror
#!/bin/sh
echo "Top 5 Alpine Mirrors:"
for MIRROR in $(curl -s http://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt)
do
MEASUREMENT=$(curl -s --connect-timeout 2 --max-time 5 -w '%{time_total}' -o /dev/null "$MIRROR")
TIME=$(echo "scale=0;(${MEASUREMENT} * 1000)/1" | bc)
echo "${TIME} ${MIRROR}"
done | sort -n | head -n5 | cut -d " " -f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment