Last active
October 30, 2023 20:58
-
-
Save yowmamasita/96bd00c81ffe823cf7123e77334ec18a to your computer and use it in GitHub Desktop.
This is the code that powers 12345-at-mastodon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1 | |
urls: | |
- mastodons://CREDENTIALS@mastodon.social: | |
- tag: speedtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
result=$(speedtest --accept-gdpr -p no -f json -I eth0) | |
resultUrl=$(echo $result | jq -r '.result.url') | |
pingV=$(echo $result | jq -r '.ping.latency') | |
downT=$(echo $result | jq -r '.download.bandwidth') | |
upT=$(echo $result | jq -r '.upload.bandwidth') | |
downV=$(echo "scale=2; $downT/125000" | bc) | |
upV=$(echo "scale=2; $upT/125000" | bc) | |
toot="${downV} Mbps down, ${upV} Mbps up, ${pingV} ms latency" | |
attachmentUrl="${resultUrl}.png" | |
apprise -c /home/pi/.config/apprise.yml \ | |
--body "$toot" \ | |
--attach $attachmentUrl \ | |
--tag speedtest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment