Skip to main content

Faster Playwright Install on Ubuntu

I noticed recently that running frontend Playwright tests on macOS via GitHub Actions is noticeably faster than on Ubuntu. This is because macOS ships with more browser dependencies out of the box, whereas the base Ubuntu image needs to install them all every run, which takes time. But Playwright has an image with these dependencies already installed! In the end it saves about 30 seconds on Ubuntu.

Recursively convert OGG to MP3

This command will recursively find all OGG files in the currently directory and nested directories and convert them to MP3.

find . -type f -name '*.ogg' -exec bash -c 'for f; do ffmpeg -i "$f" -c:v copy -q:a 2 -map_metadata 0:s:0 "${f%.ogg}.mp3"; done' bash {} +

SoundSource freezing

I can't use macOS anymore without SoundSource. However, it frequently freezes, hangs, crashes, etc. This requires a not-too-lengthy but still annoying manual flow of opening up Activity Monitor to force kill it, then opening it again. So I made it easier and automated.

pm2 Quick Start

I couldn't find a single consolidated place that explains how to setup pm2 from scratch (assuming you've already installed Node.js), and their own "quick start" didn't help. I was finally able to piece together how to get it working.

Iframe Garbage Collection

When you have an iframe loading an intense amount of content (like an entire video game, in the case of https://playfeed.io), and you need you need to reuse that iframe, you need to force the iframe to free up its memory usage so the browser will garbage collect it.

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.