Skip to content

Instantly share code, notes, and snippets.

@whamtet
Last active June 20, 2024 23:37
Show Gist options
  • Save whamtet/596b5fa1bd3637c7be538a1dcb1d59a6 to your computer and use it in GitHub Desktop.
Save whamtet/596b5fa1bd3637c7be538a1dcb1d59a6 to your computer and use it in GitHub Desktop.
#!/sbin/openrc-run
command="/media/mmcblk0p1/matt/bbroadcast.clj"
output_log="/root/bbroadcast.log"
error_log="/root/bbroadcast.error.log"
command_background="true"
pidfile="/run/bbroadcast.pid"
depend() {
need net
}
#!/media/mmcblk0p1/matt/bb
(require '[clojure.java.shell :refer [sh]])
(def router-ip
(->> (sh "arp" "-a")
:out
(re-find #"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at be:3b:a0:55:35:a4")
second))
(def my-ip
(->> (sh "ifconfig")
:out
(re-find #"inet addr:(192\.168\.\d{1,3}\.\d{1,3})")
second))
(while true
(sh "nc" "-w" "0" router-ip "4444" :in my-ip)
(Thread/sleep 2000))
@whamtet
Copy link
Author

whamtet commented Jun 20, 2024

service start bbroadcast
rc-update add bbroadcast

@whamtet
Copy link
Author

whamtet commented Jun 20, 2024

apk add libc6-compat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment