From 5ba8b0a607e44046604a4c49361cee989c6f5657 Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Fri, 26 Nov 2021 00:53:49 +0800 Subject: [PATCH] bash: add a rough speedtest --- .bashrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.bashrc b/.bashrc index 0f8eba9..f968744 100644 --- a/.bashrc +++ b/.bashrc @@ -142,6 +142,14 @@ notify() { echo -ne "\x1b]777;notify;title;$@\x1b"'\\' } +st() { + ST_SERVER=$(curl -q https://www.speedtest.net/speedtest-servers-static.php 2>/dev/null | head -n 3 | tail -n 1 | cut -f 2 -d '"') + echo download + curl -q "$(dirname "$ST_SERVER")"/random7000x7000.jpg -m 10 >/dev/null + echo upload + head -c 100M /dev/urandom | curl -q "$ST_SERVER" -m 10 --data-binary @- >/dev/null +} + # application envs export GPG_TTY=$(tty 2>/dev/null) [ -f /usr/bin/vimpager ] && export PAGER=vimpager -- 2.45.2