Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
47

The Office Bell Ringer

from Alex Meub [alt+shift+b] in programming

At my company, it’s a tradition to say “ring the bell” when we sign a new customer, release a new feature or receive other positive news, big or small. When we hear the large bell ring in the center of the office, we know that something good just happened. It’s been a great way to celebrate the wins we have together. The problem is that our remote team members are completely left out of this experience. This (as well as my obsession with all things IoT) is what inspired me to make a Slack-based automated office bell ringer. My plan was to build a Raspberry Pi-based servo that would physically ring the bell via a Slack command that could be sent from any employee (remote or not). Hardware Setup For the hardware, I used an old Raspberry Pi 3 B+ that I already had on hand and attached it to a servo to do the bell ringing. I picked up these servos on Amazon that ended up working quite well. Next, I needed a hammer arm. I wanted it to be strong and light and also something that be securely mounted to the servo. It turns out someone already designed the perfect 3D part for this use case and my coworker was nice enough to 3D print it for me 😀. I found that a drawer pull worked well as a hammerhead because it could easily be mounted to the arm and I already had some lying around. I was able to experiment with different materials and weights to determine which sound I liked the best. With the hammer figured out, I wrote a super simple python script to ring the bell using the Python GPIO module. It took some guessing and checking to get the timing figured out but I ended up with something like this. It’s also important to note that you need connect the servo wires to 5V Power (red servo wire), Ground (brown servo wire) and GPIO 21 (orange servo wire). You can use any of the GPIO pins but that’s the one I picked. You can see my wiring diagram below: Slack Integration Next, I needed to integrate it with Slack. I decided to use the awesome slackclient module (Python 3.6+...
19th Feb 2020

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Alex Meub

Vibe Coding Tools are a BattleMech

Using modern AI coding tools feels like jumping into the cockpit of a BattleMech. My co-worker used this analogy recently and I love it. It perfectly sums up the feeling of vibe coding for me. I can move faster, jump higher and it feels like a there is a whole new world of possibilities available to me. This is true for me as someone who no longer writes code every day, but many experienced software engineers don’t feel this way and I get it. They’ve been running around on foot and learned to be very effective without it. Jumping into the cockpit of something entirely new is jarring. The BattleMech can feel clunky, burdensome and they basically have to relearn all their instincts around movement and orientation (it can also sometimes shoot itself in the foot!). On top of this, many non-technical folks have also jumped into the BattleMech. They are running off in all these strange directions because they don’t know what to use it for. They are copying things, building things that suck and filling social media feeds with their creations. Many software engineers feel the same way as artists did a few years ago because pretty much anyone can create software now. The good news is that domain knowledge and software development instincts are still essential. The BattleMech can be incredible if you know exactly where you want it to go, but it’s also happy to lead you straight off a cliff.

7th Apr 2026 • 1 votes
A Look at ProgressQuest: The Original Idle Game

Progress Quest is generally considered the original idle game. It came out in 2002 as a parody of EverQuest and the emerging MMORPG boom. “Playing” it consists of creating a character, clicking “Sold!”, and then watching progress bars fill forever. There’s no interaction, no real gameplay, just waiting. At first glance, it feels like a gimmick — a joke game built to poke fun at the MMO trend. But what’s surprising is that its creator, Eric Fredricksen, built a whole RPG simulation underneath the progress bars. There are 270+ monsters, procedurally named equipment, multiple storylines, intentionally weighted stats, real loot tables, and a surprisingly complex progression system. On top of that, there’s even an authentication system for competitive multiplayer leaderboards that are somehow still around today. I love Progress Quest because of its absurdity, but also because it’s such a good example of something being far better than it needed to be. The amount of effort and attention to detail in this game makes me smile. Exponential Progression At the heart of Progress Quest is a single formula that controls level progression. The time it takes to complete level N is: (20 + 1.15^N) * 60 seconds. That means early levels take minutes (a few hours to get to level 10), while later ones take years (many years to get to level 100). There is also additional time outside of leveling for the player to go to market, buy/sell things, and head back to the “killing fields”. There are still thousands of players active across the remaining multiplayer realms, and pretty much everyone above level 95 has had the game running for over a decade. That doesn’t even count single-player characters. Races and Classes The race and class systems are hilariously absurd, but they don’t affect gameplay at all. The player races are: Half Orc, Half Man, Half Halfling, Double Hobbit, Hob-Hobbit, Low Elf, Dung Elf, Talking Pony, Gyrognome, Lesser Dwarf, Crested Dwarf, Eel Man, Panda Man, Trans-Kobold, Enchanted Motorcycle, Will o’ the Wisp, Battle-Finch, Double Wookiee, Skraeling, Demicanadian, and Land Squid. And the classes are: Ur-Paladin, Voodoo Princess, Robot Monk, Mu-Fu Monk, Mage Illusioner, Shiv-Knight, Inner Mason, Fighter/Organist, Puma Burgular, Runeloremaster, Hunter Strangler, Battle-Felon, Tickle-Mimic, Slow Poisoner, Bastard Lunatic, Jungle Clown, Birdrider, and Vermineer. Hilarious Monster Types There are over 270 hand-crafted monsters, and every one of them has a thematic loot drop. The Giant series imagines what giants would be if they were made of basically anything: Humidity Giant (drops “drops”) Beef Giant (drops “steak”) Rice Giant (drops “grain”) Porcelain Giant (drops “fixture”) Mini Giant (drops “pompadour”) The Golem series follows the same logic: Beer Golem (drops “foam”) Oxygen Golem (drops “platelet”) Cardboard Golem (drops “recycling”) The Scout hierarchy is great: Cub Scout (drops “neckerchief”) Girl Scout (drops “cookie”) Boy Scout (drops “merit badge”) Eagle Scout (drops “merit badge”) The Elemental series is an entirely new take on Elementals: Bacon Elemental (drops “bit”) Cheese Elemental (drops “curd”) Hair Elemental (drops “follicle”) Porn Elemental (drops “lube”) When the game picks a monster to fight, it level-matches against your character and then applies modifier prefixes based on the gap. That adds more flavor to the monster names. Procedural Equipment When you get new gear, the game doesn’t just pull from a list. It runs a little algorithm: Pick a base item matched to your level from a list like Stick → Shiv → Longsword → Halberd Calculate the quality gap between the item’s base level and your level “Spend” that gap across up to two modifier adjectives, each with a point value Whatever is left becomes a numeric +N prefix So a level 40 character might find a +13 Custom Holy Mithril Mail — a level 19 Mithril Mail base, with Custom (+3) and Holy (+5), leaving +13 unspent. The modifier tables are split into good and bad. If the gap is negative — meaning the item is actually better than you — the game pulls from the bad list instead: Rusty, Dull, Bent, Plastic, Nerf (-7), Rubber (-6). There’s also a whole list of spells with names like “Holy Batpole,” “Grognor’s Big Day Off”, and “Roger’s Grand Illusion” that will make their way into your spellbook and increase in level with roman numerals. The Main Game Loop Surprisingly, the game has a real game loop. It works like this: Kill monster task — The game generates a monster with a duration based on your level. When the timer finishes: Loot is added to your inventory, either a specific drop or generic loot XP is gained, which can trigger a level-up Quest and plot bars advance Check encumbrance — After a kill, if encumberance is at or above your limit, you go to market instead of fighting: The game will say “heading to market to sell loot” Then the game sells items one at a time, removing the top item in inventory and adding gold Items with “of” in the name sell for much more This continues until only gold remains Buy or head out — After selling, or if you weren’t encumbered in the first place: If the player’s gold is high enough to buy better gear, the game says “Negotiating purchase of better equipment” and the game upgrades a random equipment slot Otherwise the game will say “Heading to the killing fields” Next kill — After heading out, the game generates another monster and the cycle repeats Stat Progression When you gain a stat point, the game uses a weighted system biased toward your highest stat. Half the time, the gain is completely random. The other half uses quadratic weighting, where each stat’s chance is proportional to its value squared. That creates a snowball effect where your best stat keeps getting better, which feels authentic to how RPG builds tend to work. The only real strategy to playing Progress Quest is trying to roll high STR at character creation. Having higher STR gives you higher max encumberance which affects how often you need to go to market. The thing is, the market trips are such a small fraction of actual game time that this only about a 5% difference in how fast your character will level up. In Conclusion This is probably more than anyone wanted to know about Progress Quest. It’s an absurd, charming little game, and I hope it somehow keeps living forever. If you want to play the “multiplayer” Windows version, you can download it here. I also wanted to play on my Mac, so I vibe-coded an Swift version that runs on modern Mac hardware. See you on the killing fields!

17th Mar 2026 • 1 votes
Making a Retro Dock for the Playdate Console

I made a retro-inspired dock to charge my Playdate out of a Raspberry Pi case. The case is a miniature version of the Super Famicom and I love how it makes the Playdate look like a little game cartridge when it’s charging. Making one yourself is pretty straight-forward, you’ll just need the following components: Retroflag SUPERPi case A compact right-angle USB-C cable, like this one The 3D printed insert I designed First, print the two halves that make up the 3D printed insert and attach them with super glue. Make sure to align the cutouts on each side and then clamp the two pieces in place while the glue dries. Then take the Retroflag case apart and unscrew the main board. You’ll have to cut some wires and remove the front-facing USB ports. Make sure to leave the rear-facing USB-C port in place as we’ll reuse this to power the Playdate. Then, using a Dremel, cut a rough 86 by 21 mm rectangular hole in the top of the case. It doesn’t have to be clean as it will get covered up by the 3D printed insert. You will also need to remove some of the internal support structure inside the case using pliers or flush cutters to make space for the insert and wires. After it has dried, insert the 3D printed piece through the hole and hot glue the right-angle USB-C cable into place. Lastly, splice the USB-C cable to the red and black wires coming off the rear-facing USB port on the case. The red (or pink) USB-C cable wire should be spliced to the red wire on the USBC-C port. The two black wires should also be spliced together. That’s it! At some point I’d like to make it into a functional USB hub and add an internal LED.

27th Jul 2025 • 1 votes
Upgrading the SwarmTurret

A few years ago, I built a Wi-Fi-controlled Nerf turret, but I never got around to creating a proper build guide for it. When I finally sat down to write one, I realized just how many things I would do differently. That realization quickly snowballed into a full redesign—and the result is a vastly improved version of the SwarmTurret. This new version is not only more powerful and precise, but it’s also easier build. Here are some of the major upgrades: Simplified Assembly: I reused the shell of an existing plastic blaster, which significantly cuts down on 3D printing and makes putting it together much easier. Improved Stability: A new belt-driven Y-axis adds smoother motion and includes an adjustable tension system. Enhanced Accuracy: The camera has been repositioned for better aiming precision. Direct X-Axis Drive: I replaced the original gear system with direct motor control for more responsive movement. Performance Boost: Upgraded from Raspberry Pi 4 to Pi 5 for faster web app performance. Integrated Power Supply: Now features a built-in power supply with an on/off switch—no more fumbling with cables. Web App Enhancements: The control interface is more intuitive and responsive. I’ve published the complete build guide, along with the updated code and 3D printable parts.

23rd May 2025 • 1 votes
The Magic of Solving Problems with 3D Printing

3D Printing has allowed me to be creative in ways I never thought possible. It has allowed me to create products that provide real value, products that didn’t exist before I designed them. On top of that, it’s satisfied my desire to ship products, even if the end-user is just me. Another great thing is how quickly 3D printing provides value. If I see a problem, I can design and print a solution that works in just a few hours. Even if I’m the only one who benefits, that’s enough. But sharing these creations takes the experience even further. When I see others use or improve on something I’ve made, it makes the process feel so much more worthwhile. It gives me the same feeling of fulfillment when I ship software products at work. Before mass-market 3D printing, creators would need to navigate the complexity and high costs of mass-production methods (like injection molding) even to get a limited run of a niche product produced. With 3D printing, they can transfer the cost of production to others. Millions of people have access to good 3D printers now (at home, work, school, libraries, maker spaces), which means almost anyone can replicate a design. Having a universal format for sharing 3D designs dramatically lowers the effort that goes into sharing them. Creators can share their design as an STL file, which describes the surface geometry of their 3D object as thousands of little triangles. This “standard currency” of the 3D printing world is often all that is required to precisely replicate a design. This dramatically lowers the effort that goes into sharing printable designs. The widespread availability of 3D printers and the universal format for sharing 3D designs has allowed 3D-printed products to not only exist but thrive in maker communities. This is the magic of 3D printing: it empowers individuals to solve their own problems by designing solutions while enabling others to reproduce those designs at minimal cost and effort.

17th Dec 2024 • 108 votes

More in programming

Clip of me singing Despard in Ruddigore in 2013

A clip of me singing a funny song from Gilbert and Sullivan’s Ruddigore back in 2013

11 hours ago • 1 votes
How and Why fork() Uses Copy-on-Write

In this video, we look at why fork() needs copy-on-write, how it works inside the kernel, and a memory usage problem that Instagram encountered with Python.

17 hours ago • 1 votes
What we lost when we lost comments

Comments require commitment, but they’re worth it.

23 hours ago • 1 votes
Two-Stack Sliding-Window Aggregation

An aggregation is some kind of summary of a set of data. This can be the sum, length, minimum, etc. It is quite common to want to calculate such a summary repeatedly, e.g. “the maximum noise level in dB for the past 30 seconds” for a nuisance detector. In such a case we say there is a sliding window over our data, and we want to aggregate over our window. If our aggregation is a binary operator with an inverse, like integer sums, there is a very easy solution using a double-ended queue: from collections import deque class SlidingWindowSum: def __init__(self): self.sum = 0 self.elems = deque() def push(self, x): self.sum += x self.elems.append(x) def pop(self): self.sum -= self.elems.popleft() def eval(self): return self.sum But what if our operator has no inverse? This is actually the case for most interesting summaries such as minimum, quantile, approximate unique count (for example using HyperLogLog), etc. In fact, even something as simple as a floating-point sum suffers from the fact that floating-point addition is not invertible. For example, if you ever have a NaN in your input data with the above naive algorithm your sum will forever remain NaN, even long after the bad value has left your window. Six years ago I came up with an algorithm for maintaining just the minimum/maximum in a sliding window and posted it to cs.stackexchange. I now consider this algorithm pointless, because it turns out there is a simple and efficient algorithm that solves this problem for a very wide class of aggregations. I’m writing this blog post to spread the word, because I feel it should be more widely known. Folklore I came across this algorithm while reading a far more advanced paper, Low-Latency Sliding-Window Aggregation in Worst-Case Constant Time by Tangwongsan et al. Why is this paper titled low-latency? Because it does the same as what I’m about to describe, but in O(1) time for each step. However, in it they also described a “two-stack” algorithm, which does it in amortized O(1), and is far, far simpler. Amortized O(1) means that across many operations the total amount of work per element is constant, but an individual operation can take much longer. This is almost always fine, unless you absolutely need a low upper bound on latency. Funnily enough that paper attributes this algorithm to “adamax” from a 2011 Stack Overflow post. They in turn credit a 2001 lecture note by D. Sleator for the inspiration. However, this lecture note does not describe a sliding window aggregate, it describes the classical two-stack algorithm for implementing a FIFO queue and does amortized analysis on it. Ultimately I would not be surprised to find that this algorithm was already described in an obscure paper from the 1970s, seeing how simple and brilliant it is. Two stacks Like the authors of the paper, I will generalize the two-stack algorithm to arbitrary associative aggregation functions. By abstracting the aggregation as a set of functions, empty(), unit(x), combine(x, y) and finalize(x), you can describe many possible aggregations, for example a mean: empty = lambda: (0, 0) unit = lambda x: (x, 1) combine = lambda x, y: (x[0] + y[0], x[1] + y[1]) finalize = lambda x: x[0] / x[1] if x[1] else None I’d like to note here that these functions have the following signatures: fn empty() -> Agg; fn unit(x: Value) -> Agg; fn combine(x: Agg, y: Agg) -> Agg; fn finalize(x: Agg) -> Out; I’m making a distinction here between Value, Agg and Out because while they seem superficially similar for something like an integer sum, for an approximate unique count on strings you would have (Value, Agg, Out) = (String, HyperLogLogSketch, u64), three wildly different types. Without further ado, the algorithm: class TwoStackAgg: def __init__(self): self.values = [] self.values_agg = empty() self.cum_aggs = [] def push(self, x): self.values.append(x) self.values_agg = combine(self.values_agg, unit(x)) def pop(self): if not self.cum_aggs: cum_agg = empty() while self.values: cum_agg = combine(unit(self.values.pop()), cum_agg) self.cum_aggs.append(cum_agg) self.values_agg = empty() self.cum_aggs.pop() def eval(self): return finalize( combine(self.cum_aggs[-1], self.values_agg) if self.cum_aggs else self.values_agg ) That’s it, the entire algorithm. There’s two stacks (values and cum_aggs) and one more aggregate, values_agg. At any point in time values_agg holds the aggregate of values, and cum_aggs contains the cumulative aggregates of all values in our window that aren’t in values, in reverse order. From this we can get the aggregate over our entire window in constant time by by combining the last value of cum_aggs with values_agg. The neat part is that (assuming w is our window size) every wth operation we drain all of values and maintain a running aggregate while pushing the partial cumulative aggregates onto cum_aggs. This is what makes it amortized O(1), doing O(w) internal operations every wth pop bounds the total amount of work per element to O(1), even though a singular operation might not be constant time. I think this is best visualized. Suppose we sum [1, 2, ..., 10] with a fixed-size sliding window of four elements, then the state on each eval() call would look like this (values_agg not shown as it is simply the aggregate of the values): cum_aggs values out [] [] = 0 [] [1] = 1 [] [1, 2] = 1 + 2 [] [1, 2, 3] = 1 + 2 + 3 [] [1, 2, 3, 4] = 1 + 2 + 3 + 4 [4, 3 + 4, 2 + 3 + 4] [5] = 2 + 3 + 4 + 5 [4, 3 + 4] [5, 6] = 3 + 4 + 5 + 6 [4] [5, 6, 7] = 4 + 5 + 6 + 7 [] [5, 6, 7, 8] = 5 + 6 + 7 + 8 [8, 7 + 8, 6 + 7 + 8] [9] = 6 + 7 + 8 + 9 [8, 7 + 8] [9, 10] = 7 + 8 + 9 + 10 [8] [9, 10] = 8 + 9 + 10 [] [9, 10] = 9 + 10 [10] [] = 10 [] [] = 0 In total the memory usage is O(w), where w is your maximum window size. Note that for simplicity of analysis and the example I assumed a fixed-size window w, but there is nothing about the two-stack algorithm that requires this. You can call push(x) and pop() as many times as you’d like between each eval(), growing and shrinking the window size as needed. Floating-point non-associativity Note that we required above that our aggregate combine is associative, meaning: combine(combine(x, y), z) = combine(x, combine(y, z)) Technically speaking, floating-point addition doesn’t respect this. Nevertheless, the above algorithm is still very useful because the results closely match the expected outcome, even more so if you use a compensated summation algorithm like Kahan summation. Another neat thing about the two-stack algorithm is that it doesn’t require commutativity, if you follow the above implementation precisely. The order of operands is maintained, which can matter for things like string concatenation. However, there is a second very useful property of the above algorithm. Each aggregate is strictly a combination of the elements in the window, and none outside the window. This means if your window contains a NaN or infinity (or some other outlier), that value only poisons the windows that contain it rather than the rest of your computation. But even without NaN or infinity it is useful, due to not propagating errors endlessly. E.g. if your sliding window starts with [1e20, 1], this is what would happen with a naive rolling sum: >>> 1e20 + 1 - 1e20 - 1 -1.0 Compensated summation will reduce these effects, but not making your result depend on values outside of the window will eliminate long-term error accumulation entirely.

23 hours ago • 1 votes
Lighthouse map

Lovely global map with animated lights sweeping the waters

yesterday • 1 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in