Skip to content

Instantly share code, notes, and snippets.

@natanlao
natanlao / aws-s3-include.md
Created October 21, 2021 20:14
`aws s3 cp`, `aws s3 sync` not excluding/including keys properly

It turns out that the order of the --exclude and --include flags passed to aws s3 sync and aws s3 cp matters, so

aws s3 sync 's3://my-bucket' . --include '*' --exclude '*.png'

won't download anything but

aws s3 sync 's3://my-bucket' . --exclude '*' --include '*.png'
@natanlao
natanlao / syncthing-photo-sync.md
Last active May 5, 2024 04:59
Syncing iPhone photos with Syncthing

For those who prefer to avoid solutions like iCloud Photos and Dropbox for backing up photos, you can sync your iPhone photos with Syncthing. To do this, you'll need two things:

  • Möbius Sync is, to my knowledge, the only actively-maintained Syncthing client for iOS. It's free to sync up to 20 MB, and only $4.99 (one-time) to remove that limit.

  • PhotoSync is a nifty iOS app for syncing photos to a number of different destinations. It's free for low-quality

@natanlao
natanlao / gist:411ca6567540fc4aa0b2facbf257a3e0
Created April 26, 2021 02:53
Notes on mounting an external ZFS pool with NixOS
Going to come back to this at some point far in the future, forgot to keep track while I was doing it.
1. Add `zfs` to `environment.systemPackages`
2. Set `networking.hostId`, do `boot.supportedFilesystems = [ "zfs" ];`
3. Force import pool
4. Reboot
5. Things work
@natanlao
natanlao / followups.md
Last active July 7, 2021 05:42
Job application follow-up emails
@natanlao
natanlao / dependabot.md
Last active November 9, 2022 14:48
Automatically merging Dependabot PRs

The best way I've found to automatically merge Dependabot PRs is to use actions/github-script to comment @dependabot merge on Dependabot PRs. There are a few reasons why I think this approach makes sense:

  • Commenting @dependabot merge on a Dependabot PR instructs Dependabot to merge the PR after tests (if any) pass, so we don't need to encode that dependency in a workflow file.

  • Unlike using an auto-merge action, nothing happens if the workflow runs on a

@natanlao
natanlao / uc-dcp.md
Last active January 20, 2021 07:25
Guide to the Defined Contribution Plan for UCSC undergraduates

Guide to the Defined Contribution Plan for UCSC undergraduates

First, a disclaimer: I am neither a lawyer nor a financial adviser, and if I were, I wouldn't be your lawyer or financial adviser. This is neither financial advice nor legal advice. I didn't even study this stuff.

That said, I've provided sources where appropriate. In particular, I'll refer to these documents:

  • this UCSC Career Center [Defined Contribution Plan documentation][cc], which
@natanlao
natanlao / dokku.md
Last active March 30, 2021 22:35
Dokku reference

I host side projects on a DigitalOcean droplet running Dokku. For reference:

One-time setup of Lets Encrypt

$ ssh root@platform.natan.la sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
$ ssh dokku@platform.natan.la dokku letsencrypt:cron-job --add

Creating an app

Problem

Cannot add Apple recovery key

Reproduced on

iPhone XR, iOS 14.2

Symptoms

@natanlao
natanlao / vanilla.md
Created November 28, 2020 23:45
Warning about Vanilla eGift Cards

If you receive a Vanilla eGift Card, you should know that the link to the page with your eGift card details will expire after some weeks. The link can supposedly be reissued, but it must be requested by the person who purchased you the eGift card over the phone. So, best to save the card details somewhere once you receive them.

The eGift Card funds are advertised as never expiring. It's not clear to me if that guarantee holds for funds left inactive for a long period of time.

@natanlao
natanlao / zfs.md
Created October 23, 2020 07:04
Cross-platform filesystem

I spent some time recently looking for a cross-platform filesystem to store some personal data. After some deliberation, I settled on a single-volume ZFS "pool" and I'm pretty happy with it. Here's why:

  • Strong cross platform support. Works natively on Linux, macOS, and Windows.

  • [Native encryption][encryption]. ZFS supports encryption out of the box. It would have been possible to use something like VeraCrypt to encrypt a