React Hooks: A very brief intro

React Hooks API appears to be a immediate-mode layer on top of the traditional retained-mode style React system. Internally, the library knows which component is currently being rendered and since a hook can only be called from a React component function or another hook, React is able to keep track of function calls to the hook APIs to ‘magically’ manage state without being explicit about function calls across multiple render cycles.

Read More

Trigger bash commands in a Docker container from host

Here is an easy way to trigger a command inside a docker container. One use case of this is to trigger a compiler, which is running inside a container, to recompile sources. Make sure inotify-tools is installed on the container, apt install inotify-tools (Debian/Ubuntu), pacman -S inotify-tools (Arch). It’s also assumed some directory is mounted on the container which the host can write to and container can read. The trick here is a .

Read More

A Few Thoughts About Elm

Note: This is fairly rough right now. I may come back and revise it in the future. This will not be an introduction to Elm. If you do not know what Elm is, have a look at the wikipedia article about Elm and the Elm website. Prior to learning Elm, I did not know anything about functional programming aside from map and some vague understand of reduce. Of course, functional programming is a lot more than just map and reduce.

Read More

An Implementation of Parallel Shearshort in C using PThreads

This will be a look at a parallel implementation of Shearsort using POSIX Threads (PThreads) in the C programming language. This is not meant to be an efficient or optimal implementation, nor should it be considered production ready code. This is purely an educational exercise. I’m also not a seasoned C/C++ developer, so expect some errors or downright stupidity here and there. If you have any suggestions for improvements feel free to create an issue on GitHub.

Read More

GNOME Mutli-Monitor Workspace Fix (Gnome 3.30)

workspaces_only_on_primary setting is suppose to make workspaces work correctly [1] in a multi-monitor setup. There are older articles on the internet about enabling this option, but they won’t work with newer versions of GNOME. Prior to 3.30, I was using a very similar command which was described by Greg Cordts in his post on the subject. After upgrading to GNOME 3.30, this way of enabling the option stopped working. After reporting this to the GNOME team as a bug, two individuals provided some very useful information,

Read More

Hide YouTube's "Recommended For You" suggestions

One thing I find quite annoying with YouTube is “Recommended For You” spam in the related videos section. I do not sign into YouTube and use Firefox Containers so most “Recommended For You” videos are irrelevant, distracting, and seem suspiciously like they’ve been paid for (I don’t know if this is true). As a user of uBlock Origin, I do have the ability to add custom filters to block DOM elements.

Read More

Book Notes - Matthew Griffith, "Why Elm"

Elm incorporates some of the advances from the last 40 years of programming design without learning academic jargon Many pain points of frontend development don’t exist in Elm - nulls, undefined is not a function - and runtime exceptions are extremely rare Static typing, compile time checks, friendly error messages, type signature inference Some experience Elm programmers will start a program by sketching out the type signatures first to get a high-level view of what the various APIs will be, organization will look like and create a specification for the code.

Read More

Using Rsync to efficiently backup (mirror) hard drives

The concepts discussed here are not Raspberry Pi specific and can easily be adapted for other uses. Background I have a Raspberry Pi setup with an external hard drive that is accessible over Samba. It’s be quite reliable so far, but I wanted to backup the data to another external drive hooked up to the same Raspberry Pi. I found a simple solution to this problem using Rsync and Systemd timers (as opposed to installing Cron and learning Cron, but if you wish, you can substitute Systemd with Cron).

Read More

How to access the McMaster CAS virtual machines on Linux host

There is a web client available, but still requires a connect to the VPN. See CAS wiki[ref 1] for more information. Using openconnect Install openconenct openconnect sslvpn.mcmaster.ca (try with sudo if it fails) If nothing failed, you should be connected Tested on Xubuntu and Debian (x86_64). Download the VPN client for linux, *.tar.gz from https://www.mcmaster.ca/uts/network/vpn/ Download the VMWare Horizon client, *bundle from https://www.vmware.com/go/viewclients cd to the location of both downloads

Read More