dlow's bloghttps://blog.dlow.me/Recent content on dlow's blogHugo -- gohugo.ioen-usMon, 11 Mar 2024 19:18:37 +0000Life stackhttps://blog.dlow.me/life-stack/Mon, 11 Mar 2024 19:18:37 +0000https://blog.dlow.me/life-stack/Software and gadgets I use. Inspired by this page.
Workstation MSI Stealth i7 7700HQ 32GB ZSA Moonlander Keyboard Advantage Keyboard Others Galaxy Tab S8+ OnePlus8 Sony Alpha 7 Mark II Software Tracking Grocy - Tracking ingredients bought and usage Firefly III - budget and network calculation Others Immich - Photo hosting service Usememo - Microblogging, bookmark service, not taking Urbackup - Self hosted backup service. Nextcloud - Personal cloud that replaces the likes of dropbox.Network Router in Bridge Modehttps://blog.dlow.me/homelab/network-router-in-bridge-mode/Sun, 03 Mar 2024 23:22:10 +0000https://blog.dlow.me/homelab/network-router-in-bridge-mode/I wanted to document a new knowledge I discovered recently. It shows how I used a D-Link router to extend the wireless coverage while keeping only one networking subnet.
Background I live in a Victorian terrace house which is narrow and long. The main router from the ISP (VM Hub 3) is located at the front of the house. As a result, the study room which is located at the back of the house does not get strong WiFi signals.First Year Solving Advent of Code in Rusthttps://blog.dlow.me/programming/first-year-solving-advent-of-code-in-rust/Mon, 27 Dec 2021 20:23:19 +0000https://blog.dlow.me/programming/first-year-solving-advent-of-code-in-rust/This is the first year I’m participating in Advent of Code at the suggestion of my colleague. After solving the first few days in Golang, I decided that it is a good opportunity to try out a new language.
I first heard of Rust through ripgrep. It was so fast and responsive to use as a replacement for grep that I got intrigued by the language it was written in. Later on, I became curious about its borrow checker, a unique mechanism to ensure memory safety.SLO and burn ratehttps://blog.dlow.me/everything/slo-and-burn-rate/Thu, 22 Apr 2021 09:19:25 +0100https://blog.dlow.me/everything/slo-and-burn-rate/In this post, I want to share my understanding of burn monitor and the calculations behind it. I’ll cover the definitions, the link between SLO target, burn rate target and error rate target. We’ll go on a journey to understand how we will arrive at the number 14.4. Hopefully this gives a different perspective or serves as a guide when reading the [chapter in the SRE book: alerting on SLO]1.bubble sort and tetrahedral numbershttps://blog.dlow.me/everything/bubble-sort-and-tetrahedral-numbers/Wed, 14 Apr 2021 10:17:36 +0100https://blog.dlow.me/everything/bubble-sort-and-tetrahedral-numbers/Today I had a very simple problem in one of my Golang side projects. I have a server that retrieves a JSON array of objects that have the same schema and I want to display them in a server side rendered HTML table on a web page1. If I had unlimited time, I would probably have started a Create-React-App project and stick in a popular table library that takes care of rendering this JSON object.Setting up Home Lab with VPS and Wireguardhttps://blog.dlow.me/homelab/setting-up-homelab-with-vps-and-wireguard/Sun, 08 Nov 2020 09:45:27 +0000https://blog.dlow.me/homelab/setting-up-homelab-with-vps-and-wireguard/This post documents my journey setting up a home lab, where I run open source software like shaarli, wallabag and nextcloud, and exposing it on the internet using a cheap VPS and Wireguard.
There is no shortage of online tutorials on installing wireguard on Ubuntu, Debian, and Raspberry pi. However, it still took me about 1 full day to get a full system working. Half of it was debugging why it wireguard wasn’t installed properly.A side car puzzlehttps://blog.dlow.me/maths/a-side-car-puzzle/Wed, 28 Oct 2020 23:59:41 +0000https://blog.dlow.me/maths/a-side-car-puzzle/Problem 32 from the penguin book of puzzles.
A Side-car Problem Atkins, Baldwin and Clarke had to go a journey of fifty-two miles across country. Atkins had a motor-bicycle with side-car for one passenger. How was he to take one of his companions a certain distance, drop him on the road to walk the remainder of the way, and return to pick up the second friend, who, starting at the same time, was already walking on the road, so that they should all arrive at their destination at exactly the same time?A walking puzzle where you're only told distanceshttps://blog.dlow.me/maths/a-walking-puzzle-where-youre-only-told-distances/Wed, 28 Oct 2020 23:16:36 +0000https://blog.dlow.me/maths/a-walking-puzzle-where-youre-only-told-distances/Problem 39 from the penguin book of puzzles.
A man named Jones set out to walk from A to B, and on the road he met his friend Kenward, ten miles from A, who had left B at exactly the same time. Jones executed his commission at B and, without delay, set out on his return journey, while Kenward as promptly returned from A to B . They met twelve miles from B.A walking puzzle where you're only told about timehttps://blog.dlow.me/maths/a-walking-puzzle-where-youre-only-told-about-time/Tue, 27 Oct 2020 21:51:13 +0000https://blog.dlow.me/maths/a-walking-puzzle-where-youre-only-told-about-time/Problem 26 in penguin book of puzzles.
A Walking Puzzle A man set out at noon to walk from Appleminster to Boneyham, and a friend of his started at two p.m. on the same day to walk from Boneyham to Appleminster. They met on the road at five minutes past four o’clock and each man reached his destination at exactly the same time. Can you say at what time they both arrived?IMO 2020https://blog.dlow.me/maths/imo-2020/Wed, 14 Oct 2020 08:09:47 +0100https://blog.dlow.me/maths/imo-2020/IMO 2020 was an interesting one because it was completely virtual due to Covid-19. Personally, I would feel disappointed if I were a contestant because I would have loved to use this as an opportunity to visit Russia, which would have been a costly trip on its own.
The problems can be found on the imo-official website.
I tried the problems and this is the write up for my attempts and motivations.Objects and Data Structure/Containerhttps://blog.dlow.me/programming/object-and-data-structure/Wed, 14 Oct 2020 06:34:42 +0100https://blog.dlow.me/programming/object-and-data-structure/The differences and how it affects code maintenance.Using the reflect packagehttps://blog.dlow.me/programming/golang/using-the-reflect-package/Tue, 15 Sep 2020 22:54:19 +0100https://blog.dlow.me/programming/golang/using-the-reflect-package/An example of how to use reflect package to access fields of unexported structs in golangLiar's paradox and truthfulness of statementshttps://blog.dlow.me/everything/liars-paradox-and-truthfulness-of-statements/Sun, 13 Sep 2020 10:18:25 +0100https://blog.dlow.me/everything/liars-paradox-and-truthfulness-of-statements/An essay on truthfulness of statements and what we can learn from themGeometric puzzles using elementary operationshttps://blog.dlow.me/maths/constructing-tangent/Fri, 17 Jul 2020 10:11:55 +0100https://blog.dlow.me/maths/constructing-tangent/I’ve been playing Euclidia and I love it so far. Here’s some of the interesting challenges that I was stuck at for a while. The stage which the puzzle happens is included in the brackets.
The following challenges must be solved using only elementary Euclidean operations, which is defined as a construction that can be made with a real compass and straight edge. Marking intersections are not counted as an operation.Some notes harmonic meanhttps://blog.dlow.me/maths/harmonic-mean/Thu, 16 Jul 2020 09:44:46 +0100https://blog.dlow.me/maths/harmonic-mean/These are some notes on harmonic mean taken some time in 2016.
Harmonic mean We start by introducing three number sequences:
An Arithmetic Progression (AP) is given by $a$, $a + d$, $a + 2d$, … A Geometric Progression (GP) is given by $a$, $ar$, $ar^2$, … A Harmonic Progression (HP) is given by $\{1/a_i\}$ where $\{a_i\}$ is an AP. Given a number sequence, we can define its mean. We use two here for simplicity.Geometric problem 1https://blog.dlow.me/maths/geometry-1/Thu, 16 Jul 2020 09:00:15 +0100https://blog.dlow.me/maths/geometry-1/Found this while browsing and thought it was interesting. I’m still deciding whether this should live on this blog. Don’t permalink to this yet!
Source
Technically there are two possible answers for x, but if you restrict ABC to be acute, then there is only one solution.
Posed differently:
Given an angle A and an internal angle bisector of A Let $A = 2 \beta $ Choose a point D on the bisector Choose B on one leg of the angle such that $DBA = \alpha$ Find the loci of C on the other leg such that $DCB = 90^\circ -\alpha - \beta$ Solutions: Stolen from the comments from the original source: Using Ceva’s theorem: We can simplify it to become $$ \frac{\sin(\alpha)}{\sin(\pi/2-\beta-x)} \cdot \frac{\sin(\pi/2 - \alpha - \beta)}{\sin(\beta)} = 1 $$Metaphorical fences in programminghttps://blog.dlow.me/programming/metaphorical-fences/Mon, 06 Jul 2020 08:53:17 +0100https://blog.dlow.me/programming/metaphorical-fences/Imagine that you bought a new house with a huge backyard garden and there’s this ugly high opaque fence in your garden. You’re eager to redesign the garden to your liking, and wish to tear down this fence. Before you tear the fence down in this thought experiment, stop and think about why it was put up in the first place. Perhaps it was to prevent wild animals from entering your premise, or perhaps it was to protect your privacy from nosy neighbours?Reflections on note taking softwarehttps://blog.dlow.me/everything/reflections-on-note-taking-software/Fri, 29 May 2020 22:44:18 +0100https://blog.dlow.me/everything/reflections-on-note-taking-software/With so much information out there today, having a system to process and manage them is crucial to not be overwhelmed. For me this involves having a good digital information capture and retrieval workflow, a.k.a note taking. I classify notes into three categories: micro text notes (<500 characters), notes consisting primarily text (including code), and notes that have embedded media like images. Micro text covers consists of fleeting thoughts and requires almost immediate offloading from the mind otherwise it will be forgotten.Anti pattern: turning struct into interfacehttps://blog.dlow.me/programming/golang/anti-pattern-turning-struct-into-interface/Sun, 24 May 2020 12:44:55 +0100https://blog.dlow.me/programming/golang/anti-pattern-turning-struct-into-interface/Previously I wrote about using struct embedding to achieve pseudo inheritance for code reuse. In this post, I want to explore an example of what I think is an anti pattern as a result of the lack of inheritance and how I think it could be better.
In the absence of inheritance in golang, it is very tempting to turn fields into functions of an interface.
As an motivating example, consider the following:Struct embedding as implicit compositionhttps://blog.dlow.me/programming/golang/struct-embedding/Fri, 22 May 2020 11:26:33 +0100https://blog.dlow.me/programming/golang/struct-embedding/In programming, the principle “don’t repeat yourself”, DRY for short, recommends that we try to reuse the same implementation where possible. In this post, I will cover what it’s like to do it in golang through struct embedding and my personal thoughts on that pattern.
Golang struct embedding One common way of code reuse is inheritance. In Java, we can do this by implementing a method on the parent class, then subclasses will inherit this implementation.