Category: Uncategorized

  • Innovation and Necessity

    So many people want “innovation.” It’s almost — or maybe it is — a buzzword. Something people say they want but have no idea how to attain it. Innovation doesn’t just magically appear from thin air. No, if you want innovation, you must desire something and a solution must be necessary. Let me back up…

  • No, a 172 ip address doesn’t mean it’s in Docker

    A very popular CLI tool, I shall not name, assumes that if it is running on a machine with a 172.x.x.x IP address, then it is running in Docker. I’m not even making this up, and if it is, it changes the entire behavior to a ‘production mode.’ First of all, the actual IP range…

  • When to Roll Your Own

    Libraries are amazing. No, not the place where you go and get books for free (though, those are amazing too!), but software libraries. Libraries let you “skip” a bunch of work and go straight to the meat and potatoes of your software. If you are writing scheduling software, you can get an open-source library to…

  • How can I tell the difference between acceleration and up/down?

    Einstein once proposed a thought experiment involving an elevator, basically, you can’t tell the difference between acceleration and gravity. Since I spend a lot of time on trains, metros, and buses, I’ve been curious about how my body can tell the difference between acceleration and going up or down a hill. Ultimately, I can tell…

  • Linux Kernel: A Single Point of Failure

    The last 24 hours have been an absolute disaster of downtime for me. I’m talking about servers being down kind of downtime, not the netflix-and-chill kind of downtime. The end result of this is that I discovered a new (to me) single point of failure This blog is one of several things that run on…

  • I don’t know why ‘spaces’ won against ‘tabs’

    I spent five years in a codebase with tabs instead of spaces. In my editor, I had indents set to 2 spaces. GitHub annoyingly defaults to 8 and requires customization in order to fix that. Because of the prevalence of spaces, we often had to maintain forks of tooling to support tabs because ‘spaces has…

  • Wait, a 304 reply can change headers?

    Wait, a 304 reply can change headers?

    This evening I was optimizing some caching things for a web app I’ve been working on when I discovered something obvious when you think about it. Now, this is specific to Chrome-ish browsers and Firefox; I have no idea what will happen in Safari. Imagine the following PHP code: This code sets a random integer…

  • Algorithms in PHP: Deques (circular buffers & linked lists)

    In the previous post, I talked about priority queues. But in my explanation of an alternative implementation, I neglected to mention a few things: The alternative implementation isn’t for production; there are edge cases and unhandled errors. The alternative implementation is meant for a short queue, not an infinite one, such as the one you…

  • Algorithms in PHP: Priority Queues (and Heaps)

    This is the beginning of a series on implementing various algorithms in idiomatic PHP and their reference implementation (usually based on C++). Today we’re going to be talking about Priority Queues. A priority queue is where each value has an associated “priority” that determines which order things come out of the queue. The best real-life…

  • Stateless-Passwordless Authentication using Cryptography

    Say you want to ensure a user has access to a given email address (or phone number) on the device that they are trying to access your service. This is handy in a number of circumstances, but more importantly, can you authenticate the user without using a database? It turns out the answer is yes,…