Skip to content

Instantly share code, notes, and snippets.

natanlao /
Last active Aug 11, 2020
Tips for working with s3cmd on

Working with s3cmd on

This document lists some problems I encountered using s3cmd on and how I solved them.

Uploading with the ONEZONE_IA class

s3cmd sync doesn't support the --storage-class argument, and even that doesn't support the ONEZONE_IA storage class. You can still upload objects to that class by specifying the x-amz-storage-class header, but s3cmd sync will ignore that. The best solution I have is to upload your files as you normally would, then use s3cmd modify to set the storage class after upload.

natanlao /
Last active Mar 22, 2020
Sticker genius quote crawler
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# Get quotes from Sticker Genius for the kind of sticker we are going to buy so that
# we can pay less money for more stickers.
# Should be easy enough to tweak this code for different products - I used Firefox
# developer tools to inspect requests made to getPrice.php.
from decimal import Decimal, ROUND_05UP
import time
import requests
natanlao /
Last active Apr 24, 2021
Generating SSH keys that will work with Arq

Generating SSH keys with Arq

Tested with Arq 5.

I encountered some issues trying to add my existing SSH key pairs with Arq. I saw errors like:

[path to key]: Key 'OPENSSH' is not supported.


natanlao /
Last active Mar 22, 2020
A non-comprehensive list of bugs with NETGEAR ReadySHARE
  • ReadySHARE only supports drives up to 4TB in size. Some routers have an even smaller limit.
  • If you are using a drive with multiple partitions, ReadySHARE can, between firmware upgrades (or maybe reboots?) switch which partition is presented in which Samba folder.
  • ReadySHARE seems to change the mount point / "share name" of attached devices based on the the current phase of the moon.
natanlao /
Created Sep 15, 2019
Caffeinating a process that is already running
bash-3.2$ caffeinate -d $(while true; do if ! kill -0 $PID; then sleep 5; exit; fi; done)
natanlao / data.tsv
Last active Mar 22, 2020
NearlyFreeSpeechNET deposit scraping
View data.tsv
payment grossfee rebate netfee deposit
$0.50 -$4.00 +$3.58 -$0.42 $0.08
$0.51 -$4.00 +$3.58 -$0.42 $0.09
$0.52 -$4.00 +$3.58 -$0.42 $0.10
$0.53 -$4.00 +$3.58 -$0.42 $0.11
$0.54 -$4.00 +$3.58 -$0.42 $0.12
$0.55 -$4.00 +$3.58 -$0.42 $0.13
$0.56 -$4.00 +$3.58 -$0.42 $0.14
$0.57 -$4.00 +$3.58 -$0.42 $0.15
$0.58 -$4.00 +$3.58 -$0.42 $0.16
natanlao /
Last active Apr 14, 2021
CCPA wall of shame

Over the last few months, I've been cleaning up after myself and filing CCPA requests where I can. Here are some of the less-friendly companies that I've encountered in this process.


Signed me up for marketing emails using the email address I provided for my CCPA request.


The worst one of them yet.

natanlao /
Last active Apr 4, 2021
docker-compose: no declaration was found in the volumes section

If, when doing something like docker-compose up, you run into an error like this:

ERROR: Named volume "server/db:/usr/share/nginx/html/db:rw" is used in service "web" but no declaration was found in the volumes section.

You're missing a leading ./, so, for example:

 - 'server/db:/usr/share/nginx/html/db'
natanlao / candidates.tsv
Last active May 30, 2020
UC Santa Cruz Student Union Assembly elections history (1999-2020)
View candidates.tsv
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 10 columns, instead of 9. in line 6.
Election Term Position Function Name Votes Proportion Winner Links Comments/Notes
1999 1999 - 2000 Campus Office Director Internal Affairs Eric Gonzalez 2046 100 TRUE
1999 1999 - 2000 Chair President Maria Catalina 720 28.1 FALSE
1999 1999 - 2000 Chair President Dylan Smith 881 34.4 FALSE
1999 1999 - 2000 Chair President Kirti Srivastava 957 37.4 TRUE
1999 1999 - 2000 Lobby Corps Director External Affairs Carolyn Boyd 655 30.4 FALSE
1999 1999 - 2000 Lobby Corps Director External Affairs Patrick McHugh 522 24.2 FALSE https://deanofstu
natanlao /
Last active Apr 7, 2021
Translating GitHub resource IDs to global node IDs

GitHub associates a unique resource ID (or "database ID" or just "ID") with each API-accessible resource. For example, each [issue][issue-id], [repository][repository-id], and [user][user-id] has a global ID. In my limited experience with it, GitHub's REST API generally does not expose endpoints by which resources can be queried by ID (though it does have some [undocumented endpoints][repo-rest]). These resource IDs have been superseded by distinct [global node IDs][global-ids] (node_id). GitHub's GraphQL API allows retrieval of a node by its ID, called a "direct node lookup".

As you can tell, you likely don't have much reason to interact with the older