Common dd commands
Apr 19, 2020
dd is a common unix tool for doing disk manipulation. One of the most common uses is writing ISOs to USBs.
Writing an ISO to USB The below command writes an ISO to a USB, to find the device to write to, run lsblk
sudo dd bs=4M if=image.iso of=/dev/sdX conv=fdatasync status=progress && sync
Deploying a Web App with Docker containers
Mar 09, 2020
Introduction Last weekend I was looking at a simple way of deploying a project I was working on, the project is a series of docker containers managed by Docker Compose.
The dockerfiles mostly following examples I found for a node backend and a create-react-app frontend I didn’t want to bother pushing the images up to a registry, I just wanted them to be built by the server (its just a side project of mine afterall).
Prometheus and Grafana configuration for Docker Compose
Feb 25, 2020
Goal Create a Prometheus and Grafana configuration that doesn’t need manual configuration after spinning up the containers. I should be able to do docker-compose up and then open Grafana on localhost:3000 and see my dashboards pre-loaded with data coming in.
Docker Configuration docker-compose.yml
prometheus: image: prom/prometheus volumes: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml ports: - 9090:9090 grafana: image: grafana/grafana volumes: - ./grafana/grafana.ini:/etc/grafana/grafana.ini - ./grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml - ./grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml - ./grafana/dashboards:/etc/grafana/provisioning/dashboards/dashboards ports: - 3000:3000 prometheus/prometheus.yml
Realtime GTFS Feed Parsing with .NET Core 3
Feb 01, 2020
What is GTFS GTFS, or General Transit Feed Specification is a specification for public transport schedules and associated geographic information.
It started as a Google project, but has changed hands to the MobilityData group. Most public transport agencies implement GTFS (at least in Australia), so its fun to play around with this data to find out what buses and trains are doing.
GTFS currently consists of two parts (the MobilityData group has draft specifications for more):
Redux Toolkit with Typescript
Jan 25, 2020
Redux Toolkit is a really exciting new library from the Redux developers. The project site describes it as “the official, opinionated, batteries-included toolset for efficient Redux development”.
When using React with Redux, I’ve always found writing Redux code a bit cumbersome. Defining action types, actions and reducers always feels like a lot of boilerplate. Plus the Redux core team deliberately leaves Redux unopinionated, so it works for as many use cases as possible.
Using Microsoft DependencyInjection, Configuration and Logging outside of an ASP.Net project
Jan 25, 2020
I wanted to use Microsoft’s dependency injection framework for a console application I was building, a little web scraper for fun. I thought it would be a simple way to get logging and configuration injection for free (using the libraries from ASP.Net). Its a bit overkill for the purpose of this application, but gave me a better idea of how ASP.Net core works under the hood.
The tricky part was finding which libraries I needed and knowing what functions to call to setup DI.
Getting started with Go
Jan 12, 2020
This article is an expression of my thoughts and approach when learning Go recently. I found parts of Go to be a bit confusing (not the language itself, instead the tooling around it), so I documented the things that confused me in the Things I Encountered, Gotchas section. Hopefully that section helps other beginners that run into the same problems that I did. When I get a better idea of how it works I’ll add a updates.
React Hooks and Functional Components
Sep 17, 2019
Intro Hooks is a relatively new feature in React which allows adding state to functional components. Hooks offer a few advantages over class components, such as easier code reuse.
This blog post is a nice overview of hooks. One of my main takeaways from the article is the three dot points at the start that explain rationale behind adding hooks to React.
I’d like to extend on some of the points mentioned in the article and rephrase them more as what improvements hooks offer:
Getting Started with Nuxt
Sep 08, 2019
As the Nuxt.js website says, Nuxt is a framework that makes it easier for building Vue applications.
From what I can tell, theres two main uses for Nuxt: Server Side Rendered applications and Single Page Applications.
A server side rendered Nuxt application is hosted through a node process on a server, which prerenders the page before sending it to a browser.
Personally I’m more interested in the SPA features that Nuxt provides, mainly because theres a plethora of free hosting options for single page applications (after all its just static HTML, JS and CSS).
Fedora Server Notes
Jun 23, 2019
firewalld configuration I installed Fedora Server on an old laptop and ran into some issues when I tried accessing an application running on it.
It ended up being a firewall issue, so Fedora uses firewalld as the firewall, which I haven’t used before, and it blocks most ports be default.
So below is the steps for exposing a MQTT broker on port 1883
firewall-cmd --add-port=1883/tcp --permanent firewall-cmd --reload The first command adds the port (1883) and protocol (tcp) as an exception to the firewall, the --permanent flag will apply this rule permanently (otherwise it will reset when the firewall is reloaded)