various tidyups

This commit is contained in:
zorruno
2026-08-15 14:58:19 +12:00
parent c85ab28c10
commit dbb0a6a89c
30 changed files with 2977 additions and 684 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
download_bytes=2000000
upload_bytes=500000
download_url="https://speed.cloudflare.com/__down?bytes=${download_bytes}"
upload_url="https://speed.cloudflare.com/__up"
download_bps=$(curl --fail --silent --show-error --location --max-time 45 \
--output /dev/null --write-out "%{speed_download}" "${download_url}")
upload_bps=$(head -c "${upload_bytes}" /dev/zero | curl --fail --silent --show-error \
--location --max-time 45 --output /dev/null --request POST \
--header "Content-Type: application/octet-stream" --data-binary @- \
--write-out "%{speed_upload}" "${upload_url}")
awk -v download_bps="${download_bps}" -v upload_bps="${upload_bps}" 'BEGIN {
printf "{\"download_mbps\":%.2f,\"upload_mbps\":%.2f}\n", \
download_bps * 8 / 1000000, upload_bps * 8 / 1000000
}'