Download src/socket.sh from Fred808/MDS: direct link, hf CLI and curl.
- Browser
- Download file 491 Bytes
-
https://huggingface.co/spaces/Fred808/MDS/resolve/main/src/socket.sh
- Command line
-
hf download hf://spaces/Fred808/MDS/src/socket.sh
-
curl -L -o socket.sh https://huggingface.co/spaces/Fred808/MDS/resolve/main/src/socket.sh
491 Bytes
| set -Eeuo pipefail | |
| lastmsg="" | |
| path="/run/shm/msg.html" | |
| refresh() { | |
| [ ! -f "$path" ] && return 0 | |
| [ ! -s "$path" ] && return 0 | |
| msg=$(< "$path") | |
| msg="${msg%$'\n'}" | |
| [ -z "$msg" ] && return 0 | |
| [[ "$msg" == "$lastmsg" ]] && return 0 | |
| lastmsg="$msg" | |
| echo "s: $msg" | |
| return 0 | |
| } | |
| refresh | |
| inotifywait -m "$path" | | |
| while read -r fp event fn; do | |
| case "${event,,}" in | |
| "modify"* ) refresh ;; | |
| "delete_self" ) echo "c: vnc" ;; | |
| esac | |
| done | |