Ever wish you could keep up with what’s going on in the world without getting mired in reading news all day? Turns out, Wikipedia publishes a current events portal, which gets updated daily. If you’re a freak like me, you probably want it served to you in an RSS feed. So do I, which is why I was using one. Unfortunately, it keeps going down, so I made my own. Check it out: Wikipedia Current Events Portal RSS.
Another version of this post first appeared on the Sotheby’s engineering blog when I worked there as a staff infrastructure engineer.
When I joined the Thundercats team, which serves various Platform Engineering and SRE responsibilities at Sotheby’s, one of the first projects I worked on was rewriting an old Python cron job in Go. This job, iam-credential-reaper, notifies people in Slack when their AWS access keys and passwords should be rotated, and it expires access keys that need to be replaced. In the process of rewriting the job, we refactored our way from spaghetti code with low test coverage to a well-factored struct with complete test coverage, fixing some bugs along the way. We used functional patterns with the help of lo, a library of higher order functions, and mo, a library of monads, both of which are possible because Go 1.18+ now supports generics.
What follows is a story of how we got from the original spaghetti code to a much cleaner approach using functional …
For a pretty cool project I’m working on, I need to connect to an array of GoPro cameras. A GoPro, if you don’t know, is a powerful but tiny camera that can record in very high resolutions as well as withstand extreme conditions, which makes it super useful for sports recording.
Unfortunately, it’s a pain in the ass to use at every turn. Its only Wi-Fi access is ad-hoc, which means you need to connect to it directly instead of connecting it to a Wi-Fi network of your own. That means the computer you’re using can’t have Internet access while connected to the GoPro. Which, conveniently, means you can’t look anything up while you’re trying to reverse-engineer the GoPro’s API. It also means that you can only connect to one GoPro at a time, which is problematic for this project.
Fortunately, we got some Raspberry Pis to play with where I work. I used one to bridge a connection between the GoPro’s limited ad-hoc Wi-Fi network and an ordinary Wi-Fi network, which not only gave me access to …
If you want to make use of an ultrasonic rangefinder, such as the MB1010 form MaxBotix, the default pulseIn() function gets you pretty far. However, if you want to do anything else in your program with any reasonable speed, you’re out of luck, as pulseIn() is a blocking method, which means it’ll freeze your program until it’s done getting a pulse. I’m building a lighthouse, which does several other things on the main loop thread that are dependent on execution speed, so this is unacceptable.
Luckily, there’s NewPing, a third-party library that operates with a bunch of ultrasonic rangefinders. To use it, you must install it. Even though it doesn’t say it supports the MB1010, it totally does, using the single pin method on the MB1010’s PW pin. I’ve taken the code in my lighthouse related to sounding the piezo based on the distance of things from the MB1010, and here’s a working example, written for and tested on the Arduino Uno SMD Edition.