Homelab Part 3: Domains
The next part in setting things up is getting domains sorted. Since I have everything on the same IP address I created a wildcard subdomain pointing to my homelab. This way I can add any names without having to update the nameserver all the time.
Caddy Normally I would use nginx as a reverse proxy but Caddy has been up and coming and I was a bit excited to see how it would work.
Homelab Part 2: Authentication with LDAP and OAuth
An annoying part about hosting services myself is managing passwords and logins for everything. Every service is a new user account with a separate password for security. Giving someone else access to a couple of services means setting up the same amount of user accounts for that person.
The simple solution to this is centralized authentication. This is commonly solved with LDAP (Lightweight Directory Access Protocol) or with OAuth depending on the methods of authentication.
Homelab Part 1: Database Backend
Before I can set up any services I will need to have some method of authentication and for that I need somewhere to store user information. This could technically be a simple SQLite database but since PostgreSQL is useful for other things I might as well start here.
Preparing PostgreSQL What is really nice about adding a stack in Portainer is how it is just a docker-compose file that can be copy-pasted directly into the interface.
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.
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.
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.
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.
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.
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.
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.