Skip to content

Instantly share code, notes, and snippets.

@candale
Last active March 10, 2022 20:55
Show Gist options
  • Save candale/9851af503ea371f8120769731b2e1d5d to your computer and use it in GitHub Desktop.
Save candale/9851af503ea371f8120769731b2e1d5d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Note: this works with openbsd-netcat
echo "Serving powerstatusforever..."
while true; do
echo -ne "HTTP/1.0 200 OK\r\n\r\n$(cat /host-sys/class/power_supply/ACAD/online)" | nc -N -l -p 5555;
test $? -gt 0 && break;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment