#!/usr/bin/env bash # k3-test/prebox_check.sh — 45-second GO/NO-GO check to run FIRST on any fresh box. # Verifies the three things that can silently burn a rental day (learned the hard way # on instance 48707384: HF CDN throttled to ~7 KB/s, i.e. un-rentable for K3): # 1. HF CDN download speed (K3 lives there) — need > ~8 MB/s, want > 100 MB/s # 2. generic internet speed (Cloudflare) — sanity reference # 3. github speed (llama.cpp clone) — need > ~2 MB/s # Usage: ssh in, curl|-bash this file or copy it over, read the verdict. set -u MBS() { awk -v b="$1" 'BEGIN{printf "%.1f MB/s (%.0f Mbps)", b/1048576, b*8/1e6}'; } CF=$(curl -so /dev/null -w "%{speed_download}" --max-time 20 https://speed.cloudflare.com/__down?bytes=26214400 2>/dev/null || echo 0) GH=$(curl -so /dev/null -w "%{speed_download}" --max-time 25 -L https://github.com/ggml-org/llama.cpp/archive/refs/heads/master.tar.gz 2>/dev/null || echo 0) URL=https://huggingface.co/Qwen/Qwen3-30B-A3B-GGUF/resolve/main/Qwen3-30B-A3B-Q4_K_M.gguf HF=$(curl -so /dev/null -w "%{speed_download}" --max-time 25 -r 0-52428799 "$URL" 2>/dev/null || echo 0) if (( ${HF%.*} < 8000000 )) && [[ -n "${HF_TOKEN:-}" ]]; then HF_AUTH=$(curl -so /dev/null -w "%{speed_download}" --max-time 25 -r 0-52428799 \ -H "Authorization: Bearer ${HF_TOKEN}" "$URL" 2>/dev/null || echo 0) (( ${HF_AUTH%.*} > ${HF%.*} )) && HF=$HF_AUTH fi echo "cloudflare: $(MBS "${CF%.*}")" echo "github: $(MBS "${GH%.*}")" echo "huggingface: $(MBS "${HF%.*}")$([[ -n "${HF_TOKEN:-}" ]] && echo " (with token)") <-- K3 download path" if (( ${HF%.*} > 100000000 )); then echo "VERDICT: GO — HF is fast, 1.5 TB ≈ 3.5 h or less" elif (( ${HF%.*} > 8000000 )); then echo "VERDICT: MARGINAL — HF usable but slow; consider hf_transfer and a long tmux session" else echo "VERDICT: NO-GO — HF CDN is throttled/broken from this host. Destroy and re-rent (plan §7)." fi