Welcome to my blog, where I make notes to myself and write to think out loud.
All views my own.
Welcome to my blog, where I make notes to myself and write to think out loud.
All views my own.
This interview with Simon Willison is great. It finally1 pushed me into using GitHub Issues for my private repositories. They’re wonderful. (In the past, I’ve been just tracking everything in Markdown. That worked, but was just OK.) As an example, I maintain a private GitHub repo with notes and documents for a private network I maintain on a volunteer basis. It’s very ad-hoc and I sometimes go months between without working on it, so I didn’t want to clutter up my personal TODO list with tasks related to it....
There have been four1 major versions of HTTP in-use in the last 30-ish years: Version RFC Year HTTP/1.0 RFC 1945 1996 HTTP/1.1 RFC 2068 1997 HTTP/2 RFC 7540 2015 HTTP/3 RFC 9114 2022 It’s surprising to me how quickly HTTP/1.1 was released after HTTP/1.0. Less than one year! HTTP/1.0 A simple, text-based protocol. Runs over TCP. Only officially supports a single HTTP request and response over each TCP connection, then the connection was torn down....
This blog post by Sean Goedecke was a great read on high-level system design patterns. Most of them were familiar to me, but I got several good ideas from it. Using a database as queue: Sometimes you want to roll your own queue system. For instance, if you want to enqueue a job to run in a month, you probably shouldn’t put an item on the Redis queue. Redis persistence is typically not guaranteed over that period of time (and even if it is, you likely want to be able to query for those far-future enqueued jobs in a way that would be tricky with the Redis job queue)....
Much productivity advice on the internet is too complicated and not actually that helpful. Complicated systems are less likely to be used due to the friction of using them and are more brittle in the face of changing needs. You are better off use basic, flexible systems; you are more likely to use simple systems and simple systems can adapt to change more easily. There are only a few tools you need to completely run your personal life....
I get the impression that a lot of people are overwhelmed by their personal email inbox nowadays and get so much email that they’ve more or less given up on it. I don’t have that problem and that’s by design, not by accident. This post explains the rules I use to keep my personal email useful and very manageable. Unsubscribe aggressively Any time you give your email address out nowadays, you will get put on a mailing list....
I regularly have to look up how to create an Echo router context with (a) path parameters and (b) query parameters, so I’m making this post as a cheat sheet for my future self. Path parameters Example: /some/random/path/:id // create your context ctx := echo.New().NewContext(request, response) // add your path param ctx.SetParamNames("id") ctx.SetParamValues("foo") Query parameters Example: /some/random/path?key1=value1&key2=value2 // create your request request := httptest.NewRequest(http.MethodPost, "/some/random/path", nil) // get existing query params query := request....
I ran across a blog post by Josh Bleecher Snyder today which has some beautiful backoff algorithms in Go. Capturing them here in case his blog ever goes offline. Algorithm 1 func do(ctx context.Context) error { const ( maxAttempts = 10 baseDelay = 1 * time.Second maxDelay = 60 * time.Second ) delay := baseDelay for attempt := range maxAttempts { err := request(ctx) if err == nil { return nil } delay *= 2 delay = min(delay, maxDelay) jitter := multiplyDuration(delay, rand....
Today I needed to remove a bad route on macOS. Normally I just reboot to do that, but I decided to learn how to do it without rebooting. Here’s how I did it. First, view the routes to confirm the route is bad: netstat -rn | grep IP_ADDR Grab the IP you care about from the “Destination” column. Use it to delete the route: sudo route -n delete DEST_IP_ADDR Done!
My work laptop was provisioned with a case-insensitive filesystem for some strange reason. This makes renaming stuff in a git repo “fun”: $mv README.md readme.md mv: 'README.md' and 'readme.md' are the same file Here’s a workaround for this problem: # give the file a temp name git mv README.md readme_temp.md git com -m "Rename 1 of 2" # then name it what you actually want to call it git mv readme_temp....
I got bit by this again today, so I’m writing it down so I can reference it later. When running docker logs -f CONTAINER_NAME | grep -v "foo" | jq, it is important to consider grep’s buffers. I am using GNU grep and, by default, it uses block buffering when not connected to a terminal (which is my case, since I piped it to jq). This means jq doesn’t get any input until a large-ish amount of text (4k?...