Mac OS to Manjaro (part 1)

After 5 years of using Mac I will finally be going back to Linux 🙂

Leaving Mac

I’ve never been a real fan of Apple and there closed ecosystem, and I never really preferred Mac over Linux. But if the company provides you with a nice MacBook you can’t complain. Macs work fine for development as it is based on BSD and with tools such as brew and iTerm 2 you can almost get fooled into thinking you’re running Linux 😉

The biggest annoyance for me though, is that horrible window management on Mac. It is just terrible. Natively there is no way of splitting windows on your screen, no drag-able areas where you can force a window to split. Thank god we could still get some nice window management using Yabai. It lets me manage my windows the way I like them, and not the way Apple decides should be the correct way. Full-screen should ‘not’ create a new workspace for a single window which can’t have other windows above or below it. I need to manually resize my window to the entire screen to make use of all the space and keep other windows around. Terrible.

And there is also the ‘safety’ around installing or running downloaded file. Having to open the system settings > security and then allow a program from an ‘unknown developer’ is a pain. I get that its really useful for your typical end-user but as a developer I will be installing and uninstalling tools on the fly. There is no option to change this AFAIK.

Then there is ‘Finder’. Spotlight (not sure if it’s a ‘part’ of Finder) does its job extremely well. Only negative side is the CPU usage when indexing files but other then that I really loved using it. But the file browser itself has a horrible navigation. Clicking a directory instantly starts renaming it, there is no right mouse button > create a new director, half of the time you can’t seem to switch away from your home folder, sometimes you can order files on type or last accessed and sometimes you can’t. The most infuriating annoyance is that I cant simple start typing the first letters of a file or directory name.

As a developer I work a lot with Docker. Docker on Mac has had performance issues since the beginning. Docker normally uses the Linux Kernel to manager resources between containers, but Mac of course doesn’t have a Linux Kernel, which means that virtual machines are being used for the Docker implementations. Other issues are related to volume performance, the way volumes are mounted, and the underlying osxfs file system. The boot time for Docker Desktop to start running takes about 3 to 5 minutes.

Split a video with FFMPEG

Splitting video’s can be really useful, e.g, when multiple subjects have been talked about during a recorded meeting. Recently I had just this use case when we did a Techtalk in Google Meets with 2 subjects. We used the built in recorder from Google to get a nice mp4 file.

For archive reasons it might be better to split this video in 2 where each video contains a subject of the meet. The fastest way to edit any type of video is of course using ffmpeg.

We can use the ffmpeg binaries from our CLI with a given start and end time to split a video.

ffmpeg -ss 00:00:00 -i Techtalk_Recording.mp4 -to 00:46:20 -c copy TechTalkPhpStorm.mp4

This will copy a new video from the original Techtalk_Recording.mp4 to TechTalkPhpStorm.mp4 which starts at the beginning and ends the video at 00:46:20. Perfect!

The second subject of the tech talk was extracted the same way:

ffmpeg -ss 00:46:35 -i Techtalk_Recording.mp4 -to 01:18:52 -c copy TechTalkAccessibility.mp4

Now we have 2 files with both just our subject. Thanks to this stack overflow thread we use the -c copy method to make sure our splits will be created really fast :).

Using NodeJS through docker as CLI

Sometimes you want to build or run a simple NodeJS or PHP script. But if your current OS doesn’t have Node, NPM, or Yarn installed it might be a hassle to install this. But if you have docker available you can run the node container as a CLI. Just add the docker run command as an alias to your host and use yarn or node as if it was living on your host itself.

alias yarn='docker run --rm -ti -v ${PWD}:/app -w="/app" node:lts-alpine yarn'
alias node='docker run --rm -ti -v ${PWD}:/app -w="/app "node:lts-alpine node'

We mount the current directory (${PWD}) to the /app directory in the container and make sure we remove (--rm) the container after running the commands.

By giving the -ti flag we make sure then when we can interact with the shell when needed, i.e. when running yarn init