Git Identities

Background I have one laptop with both personal and work projects. I have organised code into two folders, work and personal so I want to use a different git identity for each: /code/work /code/personal .gitconfig The basis for the solution here is we can conditionally include other config files in the main .gitconfig file and then create a different .gitconfig file for each identity. For example here is the main file:...

December 19, 2023 · 1 min

Golang Error Handling

Tips for better error handling in go: Wrap the error being returned using %w and fmt.Errorf() Avoid words like failed or error - it is an error so we know something went wrong Use present tense to describe what the code is trying to do // good fmt.Errorf("connecting to db: %w", err) // bad fmt.Errorf("could not connect to db: %w", err) what makes Go’s error handling different is the opportunity it gives the programmer to tell a story....

December 19, 2023 · 1 min

F1 Expansion

I love watching Formula 1. I fell in love with it for the race between engineers as much as the drivers. Both pushing the limits of what can be done within the legal boundaries and outside too without getting caught. But the problem F1 faces in recent years is it has become a victim of its own success. It has become so popular that it cannot put on enough races for the entire calendar....

October 10, 2023 · 8 min

Galway Urban Planning

I’ve spent a lot of time thinking about how urban planning has been done and what could be done to make it better. In many ways the technical challenges aren’t all that big, the main problems are the political challenges that are around making any change to the physical environment or peoples behaviour. Even so given that there’s a lot that should be done to fix some of the issues we have....

October 10, 2023 · 3 min

Happy City

A book by Charles Montgomery about how some people are happier in cities than others. A lot of it boils down to what seems like common sense now and generally goes against what the general knowledge of cities were after WW2 and about 2015 when this book was published. This is slowly changing in modern times with planners more focusing on higher density and better public transport There’s a few central ideas that are throughout the book but generally it can be summarised as suburban low-density car-dependent neighbourhoods are bad for our health and the environment....

May 24, 2023 · 4 min

Using GORM

What is GORM? It is an ORM built to be used in golang. Previously I was using bun but came across a few issues which proved more complex than they should be so I transitioned to GORM to test out if those would help solve the issues I came across. The resulting code was far smaller but there were some things that proved challenging in GORM. What is this post about?...

May 16, 2023 · 3 min

Unit Testing fetch calls in a Cloudflare Worker

Once you have a worker set up, you probably want to write tests for it. In this guide I will show how to write tests for outbound fetch() requests using vitest and miniflare. Originally I used the following guide to get the tests working but it seems not everything is included within the guide that may be obvious for first time Worker developers. https://miniflare.dev/testing/vitest Setup Install Vitest $ npm install -D vitest-environment-miniflare vitest If you are not using service bindings you can use the following vitest....

April 27, 2023 · 2 min

Vary Header

The vary header is a response header used to create different variations of an object in the cache. In this post I will show how the vary header works, how we can use it and more importantly ways not to use the header. How the vary header works The most widely used use case for the vary header is to vary by the Accept-Encoding header. In this use case, the response returned would be different depending on what Content-Encoding the browser can support....

April 25, 2023 · 5 min

Friday Deploys

I used to be against Friday deploys. We all know the memes and wisdom that tell us how Friday deploys are a bad thing. I never really stopped to consider otherwise. On a basic level having a deploy freeze on a Friday makes sense for a number of reasons. One thing is we don’t want to be stuck working all Friday evening or all weekend if things go bad. Its easier to justify working a weekday evening than a Friday evening where many have other plans....

March 31, 2023 · 3 min

Increasing resource quotas in GKE

Resource quotas in GKE managed clusters are hard limits for the number of resources that can be created in a namespace. For a lot of cases you may not run into issues but the quotas are set low enough by default they may be run into for a cluster with more workloads. The quotas increase as you add more nodes to the cluster but for clusters with aggressive scale to zero or lots of small pods this increase may not happen....

March 23, 2023 · 2 min