Skip to main content

Nginx HTTPS from scratch

A simple step-by-step guide to setup Nginx with HTTPS from scratch. This was originally performed on a Raspberry Pi but should work fine on any Debian-based Linux (like Ubuntu). Keep in mind that I'm still a noob at this, so this guide might not result in the best configuration but at least it works!

Use Touch ID for sudo on macOS

Add the line

auth       sufficient     pam_tid.so

at the top of /etc/pam.d/sudo (you will need sudo access to write to that file).

You'll need to do this after at least every OS update as that file gets overwritten in those updates.

Here's a single command you can run to accomplish this:

sudo sed -i '' '2i\
auth sufficient pam_tid.so
' /etc/pam.d/sudo

Frontend Bundling

Frontend bundling is a process by which your frontend source code, typically spread across multiple files, gets squished and transformed into few files, often just one file. This post will cover some basics around bundling.

ESM vs CJS

There are currently two main module formats in the JavaScript ecosystem: ECMAScript Modules (ESM) and CommonJS (CJS). CJS was first, but ESM is now the JavaScript standard and is the future. The main difference between the two is how they import files.

Preventing Ridiculous ESLint auto-fixes in VS code

I recently adopted ESLint into my workflow and enabled fix-on-save in VS Code. I've noticed since then that sometimes massive chunks of code get deleted on save by the fixes. My current suspicion is that this is entirely to blame on the rule @typescript-eslint/no-unused-expressions. I've noticed other auto-fix issues as well, however, and will track down the culprit rules as they occur.

It is possible to leave fix-on-save enabled yet disable only the bad rules! Below is the JSON config that you will need to insert in your VS Code settings to do that. As I discover more problematic rules in the future, I'll append them below.

"eslint.codeActionsOnSave.rules": [
"!@typescript-eslint/no-unused-expressions",
"*"
],

Npm Q&A

Npm is a package manager for JavaScript projects. What this means is that it enables easy installation of packages (published to the public registry, https://www.npmjs.com, or private registries) while also installing nested dependencies between packages. I received a bunch of questions about npm, and here are the answers! Note that I haven't looked at implementation details or any specs on how npm works, these answers are merely based on my observations after nearly a decade of using npm.