Skip to content

Instantly share code, notes, and snippets.

View julianlam's full-sized 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 January 16, 2023 15:40
Re-tuning the ol' Hi-Fi #blog

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 November 28, 2022 22:24
Guide: MythTV 32, Hauppauge WinTV-quadHD, and Pop!_OS 22.04 #blog

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 November 14, 2022 16:16
Sausage and Rapini Pasta #blog

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 October 31, 2022 15:11
Fixing the burner on my GE stove #blog

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 September 23, 2022 15:13
Using `xargs` to `cd` into places and do things #blog
@julianlam
julianlam / mocha-tests-best-practices.md
Last active August 5, 2022 14:48
Best Practices for Writing Tests #blog

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 July 27, 2022 15:55
Delete all files older than X days #blog

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 / library.js
Last active July 19, 2022 07:37
How to create a login override plugin
var passport = module.parent.require('passport'),
passportLocal = module.parent.require('passport-local').Strategy,
plugin = {};
plugin.login = function() {
winston.info('[login] Registering new local login strategy');
passport.use(new passportLocal({passReqToCallback: true}, plugin.continueLogin));
};
plugin.continueLogin = function(req, username, password, next) {
@julianlam
julianlam / home-networking-cable-porn.md
Last active July 17, 2022 04:03
Home Networking Cable Porn — a weekend home improvement project #blog

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 June 9, 2022 20:14
Remove a single domain from a Certbot certificate that contains multiple domains #blog

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