Hello!

Mainly notes to myself and writing to think out loud.

All views my own.

SQL Common Table Expressions

Today I spent some time learning about SQL common table expressions (aka “CTEs”). I already use subqueries, so they were easy to understand. The syntax is very simple: WITH my_cte AS ( SELECT col1, col2, col3 FROM table1 ) SELECT col1, col3 FROM my_cte WHERE ... Here’s a more complex example with two CTEs: WITH my_cte1 AS ( SELECT col1, col2, col3 FROM table1 ), my_cte2 AS ( SELECT col4, col5, col6 FROM table1 ) SELECT my_table.*, my_cte1.col1, my_cte2.col4 FROM my_table JOIN my_cte1 ON my_table.fkey_id1 = my_cte1.col1 JOIN my_cte2 ON my_table.fkey_id4 = my_cte1.col4 WHERE ... In general, I should prefer CTEs over subqueries because: ...

2025-12-18

BASH Process Substitution

Today, I learned about shell process substitution from Break on Penguin’s latest video. Assume you have two files: $ cat file1 a b c $ cat file2 c b a To see if they are identical when sorted without manually creating your own temporary files, you can: diff <(sort file1) <(sort file2) What is happening here? <() is doing process substitution, which is running the command and then exposing its output as a temporary file. ...

2025-12-16

Sublime Text Arithmetic Command

I’ve been using Sublime Text as my main text editor since August of 2014. I know it pretty well, but occassionally I still learn something new and useful. Today I learned about the Arithmetic command from a video by OdatNurd. Summary of what I learned Variables The following variables are supported: Variable What it does s The literal selected text i The selected text interpreted as a number (0, if interpretation fails) i The index of each selection (0-indexed) Converstions hex(x) // to hex int(x) // to decimal bin(x) // to binary format() is supported format(x, ',') // add comma separators to number, 1234 -> 1,234 format(x, '^80') // center selected text in 80-character column math package is supported math.ceil(x) math.floor(x) TIP: Update numbers of an ordered list This is particularly useful; I do this all the time! ...

2025-11-19

SSH Key Best Practices

Today I needed to create a new SSH public/private keypair for work. I wanted to make sure I was following modern best practices for this, so I did some reading online. I found these two articles to be very helpful: SSH Key Best Practices for 2025 – Using ed25519, key rotation, and other best practices SSH Agent Explained Things I learned I didn’t ever think to change the comment at the end of the keyfile. Now I plan to date them, as it suggests. Using the email sub-alias (+) is clever and I’m stealing that. ...

2025-09-10

Treating strings as numbers in Golang

Today I encountered an API which sometimes sends back numbers as strings. Example response: { "age": "30" } That’s annoying, because I wanted my struct in Go to be like this: type Person struct { Age int `json:"age"` } I learned that json struct tags have a string option meant for dealing with exactly this sort of problem: The “string” option signals that a field is stored as JSON inside a JSON-encoded string. It applies only to fields of string, floating point, integer, or boolean types. This extra level of encoding is sometimes used when communicating with JavaScript programs: ...

2025-08-28

Even Easier Git Rebasing

Rebasing your feature branch on main regularly is a good idea. I used to do it like this: # update local copy of main git fetch origin main:main # rebase on local main git rebase main This always felt a litle off because I was worried I’d typo main:main and mess it up. This works just as well and feels much better to me: # update local copy of `origin/main` git fetch # rebase on origin/main git rebase origin/main

2025-08-28

How to add values to an HTTP query string in Go

Here’s how to add key/value pairs to an http.Reqest’s query string in Go: package main import ( "fmt" "net/http" ) func main() { // create a request req, _ := http.NewRequest(http.MethodGet, "http://www.example.com/", nil) // get the current query string from the http.Request values := req.URL.Query() // add or set values values.Set("myKey1", "myVal1") // overwrite! values.Add("myKey1", "myVal2") // append! // add values back to the request req.URL.RawQuery = values.Encode() // query string: mykey1=myVal1&myKey1=myVal2 // print the url fmt.Println(req.URL.String()) } The above program will output: ...

2025-08-26

Binaries on Macos

Path Note /usr/local/bin/ System-wide binaries go here! ~/bin/ My user’s binaries go here!

2025-08-22

Initial thoughts on Ghostty

I’ve been using Alacritty exclusively for over a year. It’s fantastic! But I listened to an interview with Mitchell Hashimoto and he talked about trying to make terminal multiplexers obsolete. It struck a cord with me. I’ve been using Zellij ever since I switched from Iterm2 to Alacritty and it’s great, but also it can be cumbersome. I find it cumbersome to: Search through this history (I don’t do it frequently enough for the keybindings to stick in my head.) Splitting and closing panes. (Whereas iTerm2’s keybindings to do this are burned into my brain forever.) For all iTerm2’s faults, I miss it sometimes. (The biggest reason I ditched it is because you can’t commit its config to version control easily. Its config is huuuuuuge. And I won’t daily drive anything whose config I can’t version.) ...

2025-08-18

Using Github Issues

This interview with Simon Willison is great. It pushed1 me into using GitHub Issues for my private repositories. They’re wonderful. (In the past, I’ve been just tracking everything in Markdown documents. That worked, but was just OK.) As an example, I have a private GitHub repo with notes and documents for a private network I maintain (as a volunteer). It’s very ad-hoc and I sometimes go months between without working on it. ...

2025-07-10