Homelab Part 0: Docker on Raspberry Pi

This weekend I set up a new homelab. Basically a way for me to self-host some services that I use while running my own personal tech playground. I already have this setup with a Raspberry Pi 3 where I have a few things set up in an old school fashion of running services like daemons and running everything behind an Apache2 server. There are some benefits to this in that the setup is pretty straightforward and simple to understand without layers and abstractions but the downside is the maintenance.
Read more →

Bitsy, a tiny game engine

This weekend I have played around a bit with Bitsy, a small and simple game engine. The editor is easy to grasp and though the limited scope of the engine itself might seem limiting there are some very interesting examples of games made with this. Personally I did not have as much patience or sense of narrative to create something as engaging as some other things out there. But I did make a small thing just for fun where you are stuck in a room with a cat.
Read more →

Implicit frameworks

These are some thoughts based on “Using a Framework will harm the maintenance of your software” and the discussions from the related Hacker News thread. One of the top responses included the following quote which summarizes an important point neatly. Every sufficiently complex framework-free application contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of a framework. That even when a framework has been explicitly avoided, or a minimalistic framework used, an implicit framework will eventually develop based on the culture around the codebase.
Read more →

Unicode BOM and Excel

If you have tried generating CSV files that include non-ascii characters you will have noticed that these show up as weird and double letters such as Ã¥ ä, and ö for the Swedish letters Å, Ä, and Ö respectively. When this happens in web pages there is a mismatch between the declared and actual encoding of the page. This could for example happen if you create a page encoded in Unicode but not sent as such.
Read more →

If you are using “and” you are writing bad code

Mostly everyone would agree that blindly writing SOLID code just for the sake of it does more harm than good. Just look at any example of the “enterprise editions” for FizzBuzz or Hello World. This is not to say that SOLID, KISS, DRY and so on are not useful guidelines for improving code quality and general practice. The practice that best aligns with the project goals is pretty much always the best option.
Read more →

Solving the median of two sorted arrays in O (n log (m + n))

I have been doing a bit of HackerRank and LeetCode challenges to practice and avoid skill rot since I do not do as much low level programming as I used to. While going over the discussions for one of these challenges [1] I noticed a lot of people bragging about their simple solutions while also missing the entire point of the excercise. The problem is described like this: Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
Read more →

Work faster with a simple to-do process

How I manage my work to not lose focus and stay on track. Wether I am working on a large project or am just starting out on something small and new I eventually end up with too many ideas for new features or improvements. Like pulling on a thread a small bug reveals something else that needs fixing or while implementing a new feature there is something else that would be really cool.
Read more →

How to rely on third-party CDNs in a secure way

Instead of using dependency managers and packaging tools like Webpack or Bower (or even NPM) for web resources it is tempting to instead just link directly to the resources you need. But except for avoiding complexity and having to learn something new like dependency management or semantical versioning schemes this also opens up some attack vectors. For example, if the third-party you are loading your resources from is compromised an attacker might replace your Bootstrap plugin with a key listener to steal your users passwords.
Read more →

Consolidating images with perceptual hashing

I have a lot of photos spread out over multiple devices and platforms from over the years. These are pictures from Facebook, old camera photos, Google Photos and so on. And most of these are duplicates, copied from one device to several different platforms and backups, all with very subtle differences depending on what platform they have been processed by. Most of these have some matter of export functions for photos.
Read more →

Resolutions for 2019

A couple of years ago I wrote a post with a short summary of my resolutions for the upcoming year. Things that I wanted to achieve or improve. I never followed up on it or even considered how it went or if anything should change for the next year. In terms of goal planning it was a catastrophic failure. What I should have done was to (1) made sure that my resolutions were measurable and (2) actually followed up on the progress of my goals to make sure I was on track.
Read more →