Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
I may be slow to respond.

Julian Lam julianlam

🤔
I may be slow to respond.
View GitHub Profile
@julianlam
julianlam / retuning-the-hifi.md
Last active Jan 16, 2023
Re-tuning the ol' Hi-Fi #blog
View retuning-the-hifi.md

For the longest time now, I've wanted to clean up and upgrade my Hi-Fi system, although what I had was "good enough" in many respects. I'm not audiophile by any stretch of the imagination, so I've felt that my needs were fairly minimal.

The reasons for having a Hi-Fi system at all were straightforward:

  1. I dislike how tinny TV speakers are, and how they point backwards/downwards from the back of the TV
  2. Bass response is often lacking — I once watched The Dark Knight at a friend's place, and couldn't get into it because the tiny TV speakers attempting to produce bass would just heavily distort any other sound coming from them.

For reference, my setup was inherited from my parents, who had used it back before I was born!

@julianlam
julianlam / mythtv-pop-os-guide.md
Last active Nov 28, 2022
Guide: MythTV 32, Hauppauge WinTV-quadHD, and Pop!_OS 22.04 #blog
View mythtv-pop-os-guide.md

As a cord cutter, I am an advocate of taking advantage of local broadcast signals in my area.

Not sure what kind of channels you'll get? Head on over here and find out

The following is a rough guide as to how to install MythTV on a machine running Pop!_OS 22.04.


Format the machine to Pop!_OS 22.02

@julianlam
julianlam / sausage-rapini-pasta.md
Last active Nov 14, 2022
Sausage and Rapini Pasta #blog
View sausage-rapini-pasta.md

No nonsense, just the recipe.

— Julian.


This is one of my go-tos for a weeknight dinner that is delicious, quick and easy to prepare, and does not break the bank.

Ingredients

@julianlam
julianlam / ge-stove-burner-infinite-switch.md
Last active Oct 31, 2022
Fixing the burner on my GE stove #blog
View ge-stove-burner-infinite-switch.md

I have an electric stove. It came with my house.

As an aside, since I moved into my house in 2015, every single major appliance in my kitchen has had some sort of defect. I suppose it says something about the quality of appliances nowadays.

One day the front 10-inch burner stopped working. Too bad, it was my favourite one!

A house call from a repairman later, I was told that the most likely culprit was the infinite switch behind the panel. Unfortunately, this ends the repairman's role, as he soon stopped returning my calls. Apparently, this was too small a job for him.

Complicating matters is that appliance manufacturers seem to have hundreds (if not thousands, by now) of models, all with subtle variations and combinations of parts, features, aesthetics, etc. There are some good websites that help you find out which part goes with which stove, but sometimes they have contradictory information too.

@julianlam
julianlam / xargs-cd-cheatsheet.md
Last active Sep 23, 2022
Using `xargs` to `cd` into places and do things #blog
View xargs-cd-cheatsheet.md
@julianlam
julianlam / mocha-tests-best-practices.md
Last active Aug 5, 2022
Best Practices for Writing Tests #blog
View mocha-tests-best-practices.md

This is a living document, it will be updated from time to time as my test writing evolves.

It's easy to fall into the trap of writing your tests with less care than you would your regular code. After all, if tests pass, then ship it is de rigeur, so there's an incentive — especially if the clock is ticking closer to the end of workday — to get those tests passing ASAP.

Avoid globals/leaky states

One corner that is often cut is to introduce or reuse variables between tests. For example:

  1. I am writing tests for updating a user's profile. I will create one user and run all tests against that single user.
@julianlam
julianlam / deleting-old-files.md
Created Jul 27, 2022
Delete all files older than X days #blog
View deleting-old-files.md

Sometimes you just need to prune a directory of all files older than a certain age. Think log files, or uploaded files... maybe ~/Downloads, perhaps?

find . -mindepth 1 -maxdepth 1 -mtime +90 -delete
@julianlam
julianlam / home-networking-cable-porn.md
Last active Jul 17, 2022
Home Networking Cable Porn — a weekend home improvement project #blog
View home-networking-cable-porn.md

Those that know me know that I don't exactly have a great relationship with neat cabling practices. My desktop PC builds are rather haphazard, with power cables, SATA cables, and the like snaking across and through the case with no regard for aesthetics. After all, plug A needs to go to socket A, why not take the most direct route? Brace yourselves...

fc2fbc5b808b59654664bde2c18e932507e0c5b8

Accordingly, the same work ethic seemed to follow me into my home networking setup. Through a combination of organic growth (new devices added over time), and due to the added incentive of needing to get connected ASAP when we moved in, little to no thought was put to making everything look neat and tidy.

I'll spare you the imagery, but some lovely faults:

  1. A DSL line that entered the house via a demarcation point at one end of the house, only to snake across the entire length of the house before actually entering
@julianlam
julianlam / remove-one-domain-from-san-certbot-cert.md
Created Jun 9, 2022
Remove a single domain from a Certbot certificate that contains multiple domains #blog
View remove-one-domain-from-san-certbot-cert.md

I came across a scenario where I had a certificate (example.org, below) that supported multiple domains, but one domain's (broken.example.org, below) the A record no longer existed, causing certbot to abort renewals with an error:

Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/example.org.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
@julianlam
julianlam / datetime-local-across-locales.md
Created Jun 8, 2022
Testing `datetime-local` input across various locales #blog
View datetime-local-across-locales.md

Working with <input type="datetime-local"> is a lot of fun. All major browsers have standardized their UIs, and offer full support, and so the days of using polyfills or jQuery fallbacks are numbered.

Should you need support for older or more esoteric browsers, it may be best to fall back to a bunch of <select> inputs instead.

The cool thing about datetime-local is that the UI itself is localised based on the user's browser/machine language settings.

For example, in Canada:

image