Skip to main content

Julia Evans

TILs

Some small things I've learned:

dbmate for SQL migrations with SQLite

I’ve been making a web application where I haven’t ironed out my database schema yet so I wanted a migration tool to tweak it as I change my mind.

Someone on Mastodon recommended dbmate recently and it’s been working well. Here’s how I use it:

  1. Run dbmate new my_migration
  2. Edit the migration file to
  3. Run dbmate up to apply it

Then I can run dbmate up in production too. I’ve only been doing “up” migrations, no “down” migrations.

fs_usage can trace filesystem events on Mac OS

The #1 thing I miss from Linux while using a Mac is strace. Recently I found out about fs_usage that does part of what strace does and I was SO happy.

(I’ve also tried dtruss/dtrace etc and a couple of other things which I have failed to get to work, I’m not willing to turn off SIP)

For example here’s me looking at what config files fish opens:

(for some reason I can’t grep fs_usage’s output directly, not sure why)

how to implement skip links

Just found this inclusive design checklist by Heydon Pickering. I found it because I wanted to implement a skip link for this blog, and it linked to this very clear guide from WebAIM on implementing skip links.

how to use semantic HTML

I’ve been reading advice to use semantic HTML for years but never really found an explanation that clicked. This article by Heydon Pickering really helped me understand how to do it in practice, specifically this “owl selector” tip for how to make everything evenly spaced:

.stack > * + * {
  margin-top: 1rem;
}

I also found his website’s CSS a really interesting read, especially how most of the selectors are for base HTML tags and classes but there’s occasionally something like this:

.margin-top\:0 {
  margin-top: 0;
}

screenshots in Markdown in vim

I put a lot of screenshots in my blog posts and it’s always a little annoying to take the screenshot, put it in the right folder, and insert the <img> tag.

So I finally wrote the world’s smallest vim plugin which lets me just run :Screenshot NAME and it’ll save the image from my clipboard to the right place and write the <img> tag. It uses pngpaste.

diffdiff: a great diff tool

diffdiff.net is a really nice side by side online diff tool, by Joe Kaptur. I’ve actually known about it for a long time but I’m always forgetting what it’s called.

Here’s what it looks like diffing some tcpdump output – used this to see that the MSS in two SYN packets didn’t match.

cryptographic right answers

I wanted to make a cryptographic hash for a fun side project, didn’t know how to do it, then Kamal pointed me at Cryptographic Right Answers from Latacora. Specifically I learned that I should use HMAC for signatures.

Seems like a really great resource and there’s also a post-quantum version

downloading a google sheet as a CSV

Apparently you can download a public Google Sheet as a CSV, just tried it and it works great.

unbuffer

Sometimes I run some_program | grep blah, but libc buffers the output because the program isn’t writing to a terminal (in libc, writing to a terminal is line-buffered but writing to a pipe/file isn’t). So the grep doesn’t work. It’s annoying and I’ve never known what to do about it.

I finally found a solution to this thanks to folks on Mastodon: unbuffer from the expect package. unbuffer program will open a new TTY, set the program’s stdout to that tty, and then write to the pipe itself and flush the output.

You can also use unbuffer to trick the program into thinking it’s writing to a TTY for some other reason.