Last active
June 20, 2024 23:37
-
-
Save whamtet/596b5fa1bd3637c7be538a1dcb1d59a6 to your computer and use it in GitHub Desktop.
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
#!/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 | |
} |
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
#!/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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
service start bbroadcast
rc-update add bbroadcast