Lurker News
Curious to know if anyone has written programs for their own, regular, & personal use. And if so what they are? E.g. A colleague of mine tracks all of his homes energy use through a custom program which disaggregates the energy consumption per device and outputs a report to a tablet.

Comments (651) 385 threads

Earlier comments
ghughes1 reply#
I have a fun one. The front door to my house had an automatic door opener, paired with a single-button remote control to unlock and open the door. The remote control was annoying to carry and use. (This was before IoT became a thing.)

I pried open the remote, soldered on an extra circuit bypassing the push switch, and hooked it up to an Arduino. When a packet is sent over serial, the Arduino simulates a button push:

    const int basePin = 2;

    void triggerRemote() {
        digitalWrite(basePin, HIGH);
        delay(2000);
        digitalWrite(basePin, LOW);
    }

    void setup() {
        pinMode(basePin, OUTPUT);
        Serial.begin(9600);
    }

    void loop() {
        if (Serial.available() > 0) {
            Serial.read();
            triggerRemote();
        }
    }
This was paired with a tiny web server to do the serial write:

    #!/opt/bin/python2.6

    PORT = 5525

    import BaseHTTPServer, SocketServer

    class LoccaHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
        server_version = "LoccaServer/1.0"
        def do_GET(self):
            if self.path.startswith("/trigger"):
                serial.write('A')
                self.send_response(200)
            else:
                self.send_error(404)

    serial = open("/dev/ttyACM0", 'wb', 0)

    httpd = SocketServer.TCPServer(("", PORT), LoccaHTTPRequestHandler, False)
    httpd.allow_reuse_address = True
    httpd.server_bind()
    httpd.server_activate()
    httpd.serve_forever()
Finally I threw together an iPhone app with the most basic UI imaginable: a static full-screen photo of the remote; tap once, it fires off a HTTP request, and the door swings open:

    - (IBAction)triggerRemote:(id)sender {
        NSURL *url = [NSURL URLWithString:@"http://10.0.8.48:5525/trigger"];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        [NSURLConnection connectionWithRequest:request delegate:nil];
    }
That's basically all of the code. Considering how much of a janky hack this is, it worked great.

Ancient write-up with some photos: https://web.archive.org/web/20120103180640/http://ghughes.co...

bdittmer#
At one point I had a gist with a bunch of links to a web server that controlled some home automation stuff. Add a link to your Home Screen and you’re good to go! Easy to share as well
maxmunzel3 replies#
After a quick burst of manic energy during exam phase, I decided to solve the pigeon problem on my balcony once and for all (and in a humane way).

So I bought a cheap electric water gun from Amazon, built in WiFi using an ESP8266 and a relay shield; 3D printed a window mount for my old iPhone (running a webcam app) and hacked together some openCV code in python.
After all this was working on my desk, I had the pleasure to discover that the PCB Antenna of the ESP is to weak to receive WiFi on my balcony so I connected the ESP to my (current) iPhone hotspot and wrote a small go relay for my server so that my laptop can send the shooting commands to the water gun ~~over the internet~~. Oh and while I was at it, I added a Siri Shortcut, so it’s voice controllable, too. (They are surprisingly hacker-friendly)
The surprising thing is, that this Ruben Goldberg machine actually works really well and without much fiddling.

jwilk#
Can you publish more details of your setup and the code?
MockObject#
This sounds really amazing. I'd love to read more about this!
Theory421 reply#
Does this allow you to shoot the water gun, or is it recognizing pigeons in an automated way and firing?
sprobertson#
I'd guess the latter if there's an OpenCV component
nilshauk3 replies#
Some weeks ago I wrote a couple of bookmarklets, one of which was this:

javascript:(function(){ location.href = `https://nitter.net${location.pathname}` })();
You can take this JavaScript snippet and save it as a clickable bookmark (hence the name bookmarklet) in you browser. I've named this "re-open in Nitter". I deleted my Twitter account a while back but sometimes I get handed a Twitter link. This snippet let's me quickly re-open the link in Nitter which is a nag-free way to browse Twitter without having an account. :)

sgc#
Useful! There is a nitter add-on at least for firefox, called nitter redirect. All twitter links go there seamlessly.
terinjokes#
Related, I have a bookmark called "HN Migrate" that let's me redirect an HN comment section to a mirror (currently hackerweb.app).

    javascript:(function(){!function(){var a=new URL(location.href);if("news.ycombinator.com"===a.host){var e=new URLSearchParams(a.search.substr(1));if(e.has("id")){var n=new URL("http://hackerweb.app/");n.hash="#/item/"+e.get("id"),location.href=""+n}}}()})()
At some point I might add support for deep linked comment threads, but in practice it hasn't been enough of an itch.
Matumio#
Nice use-case for bookmarklets! With Firefox I've started using the LibRedirect extension for that, which also covers other big sites.
Sohcahtoa82#
I have a strange problem with my monitor that I solved with a program.

Basically, I use a USB switch to switch my mouse, keyboard, and webcam between my personal desktop computer and the MacBook I use for work. I tried a full KVM switch at first, but every time I'd switch it to my MacBook, Windows on my PC would flip its shit. With the primary monitor disconnected, it would move everything to the secondary monitor, which was fine, except that when I moved the KVM switch back to my PC, it would move everything back to my primary display, whether or not it was originally on my primary or secondary. Additionally, since my two monitors are different resolutions, all my window sizing was wrong.
I tried to get around this by plugging my PC into my monitor's Display Port and plugging the MacBook into an HDMI port and just telling my monitor to switch inputs, and for the most part it works, but at 1 PM every day, if my monitor is set to HDMI, it drops the DP connection, making Windows think it lost the monitor, putting me back at square one.
So I wrote a simple program in Python that sits in my notification tray. I can tell it to save or restore all my window positions. So if Windows loses the monitor, after it comes back, I can restore everything to where it was.
As a bonus, I also added a "Easy Copy/Paste" menu to quickly copy emojis like ¯\_(ツ)_/¯ and ಠ_ಠ to my clipboard.

Load more comments