Skip to content

Instantly share code, notes, and snippets.

@yowmamasita
Last active October 30, 2023 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yowmamasita/96bd00c81ffe823cf7123e77334ec18a to your computer and use it in GitHub Desktop.
Save yowmamasita/96bd00c81ffe823cf7123e77334ec18a to your computer and use it in GitHub Desktop.
This is the code that powers 12345-at-mastodon
version: 1
urls:
- mastodons://CREDENTIALS@mastodon.social:
- tag: speedtest
#!/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