A little change of pace. As part of the Not Secret But Not Entirely Documented Either plan to save the Internet, I’ve been spending a fair bit of time with lisp weenies. The parenthesis are rubbing off on me, I think primarily because you can stuff lisp into tinier nooks than even Linux fits. One of them is now an LED board that I have stuck above my desk. In true Purpose Robot style, despite having more processing power than the space shuttle (or something), I have mainly used it to display a hardwired “ON AIR” when I’m on video-conferencing.
I got bored or delusional or hyperfocused the other day, and now it still mainly says “ON AIR”, but now has a ulisp interpreter to help it feel even more overpowered. You can telnet into a repl (I recommend rlwrap teln
et, there’s nothing that rlwrap
can’t improve), and I bolted on some extra commands to do graphics as well as text. Code for the signpost is up on Github, including the script that watches for a video conference on Linux and then does something, which is probably more re-usable in other contexts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#!/bin/sh # Check for the existence of the /dev/video* device(s) video_devices() { ls /dev/video* 2>/dev/null } # Main loop while true; do if video_devices | xargs fuser -s; then # If any /dev/video* device is in use, send "ON AIR" message curl -d text=" ON AIR" 'http://signpost.local/screen/' >/dev/null 2>&1 # Wait until all /dev/video* devices are no longer in use while video_devices | xargs fuser -s; do sleep 5 done # Clear the "ON AIR" message curl -d text="" 'http://signpost.local/screen/' >/dev/null 2>&1 else sleep 5 fi done |
A couple of notes: GPT helped me tidy up some of this code, which made me less ashamed to post about it online — just stuff like error-checking and error messages. Another is that giving you access to my LED signpost is one of my little “we should be able to do this in a decentralized social environment” tests: both socially and technically. The face that I don’t yet feel comfortable opening it up beyond my home is a big flag to me, and I want to keep worrying at this problem until I do.
(300 words)