pig-monkey.com

Water Rotation

I use four WaterBricks for water storage at home, and for the occasional vehicle-borne excursions. They’re simple to store in small areas, stack securely, and are easy to pour from with the spigot assembly. I prefer them over the more common Scepter Water Canisters. The 3.5 gallon capacity of the WaterBricks is in the sweet spot of being able to hold a lot of water, but isn’t so heavy that life sucks when you need to haul them around.

I took one of the WaterBricks on this year’s ARRL Field Day last month. This was the first time this particular WaterBrick had been opened in three years. The water tasted fine, albeit with a plasticy flavor that wasn’t surprising, but storing water for this length of time seems at best excessive and at worse negligent. I took this as an opportunity to implement a rotation schedule.

Each of the WaterBricks is now labelled. They are grouped in to two 12-month rotation periods, each six months apart. This provides an opportunity to not only change the water, but also bleach and dry the inside of the containers to discourage any growth. By performing the rotation six months apart, I can be assured of always having two full WaterBricks on hand.

By scheduling the rotation in taskwarrior I never have to think about it.

$ task add project:waterstorage due:2017-06-01 recur:yearly wait:due-7days rotate waterbrick alpha
$ task add project:waterstorage due:2017-06-01 recur:yearly wait:due-7days rotate waterbrick bravo
$ task add project:waterstorage due:2017-12-01 recur:yearly wait:due-7days rotate waterbrick charlie
$ task add project:waterstorage due:2017-12-01 recur:yearly wait:due-7days rotate waterbrick delta

I use 28 drops of Aquamira chlorine dioxide per WaterBrick, although I’m not sure how necessary that is now with the rotation schedule.

This post was published on . It was tagged with water.

Standard Issue Oatmeal

I go the boxing gym in the morning before work. When I wake up I throw down a small amount of yogurt and granola, but I need a second breakfast that I can easily prepare in the office after the gym. Oatmeal is a good solution. A couple years ago I started preparing my own oatmeal instead of using store-bought packets.

I started out with The Yummy Life’s Healthy Instant Oatmeal Packets recipe and tweaked it slightly to create my Standard Issue Oatmeal. At some point over the weekend I whip up a handful of servings in separate Ziploc bags that I bring in on Monday and store in my desk for the week. It only takes a few minutes to prepare the packets, and at work it is easy to dump the contents of a Ziploc into a mug, poor in hot water, stir a bit and enjoy.

I haven’t gotten tired of this recipe after eating it regularly for a couple years. The maple sugar is the key ingredient in that regard, I think. It’s easy to add in dried fruit or other garnish to mix it up occasionally.

This post was published on . It was tagged with recipe.

Thrilling Developments in the Art of Folding

I few months ago I read Marie Kondo’s The Life-Changing Magic of Tidying Up. It’s not the sort of book that usually finds its way into my library, but it had been recommended periodically by a handful of different people over a year or two. I found the book to be disappointing. Many of the pages struck me as fluff — clutter, you might say, which is ironic given its subject. Edited down to a pamphlet of a dozen pages, or perhaps a short series of blog posts, it could be enjoyable, but there isn’t enough content for a book.

The one thing I did take away from the book is folding. Kondo recommends folding things such that they stand on edge in the drawer rather then being stacked on top of each other. This way all the contents of the drawer are visible at once, instead of only the things on the top of a stack.

The goal should be to organize the contents so that you can see where every item is at a glance, just as you can see the spines of the books on your bookshelves. The key is to store things standing up rather than laid flat… The number of folds should be adjusted so that the folded clothing when standing on edge fits the height of the drawer. This is the basic principle that will ultimately allow your clothes to be stacked on edge, side by side, so that when you pull open your drawer you can see the edge of every item inside.

This made sense to me. Unfortunately, the combination of having a walk-in closet in my apartment and not owning much in the way of furniture means I don’t actually fold many of my clothes. Most things end up being hanged (a Kondo no-no). I fold some less-seasonally appropriate clothing for storage in Transport Cubes (another Kondo no-no) and I fold larger things like sheets and towels for storage in underbed boxes, but neither of those really lend themselves to this method of folding.

One of the few pieces of furniture I do find useful enough to own is a filing cabinet. I keep socks in the large bottom drawer and underwear in the middle drawer. The top drawer holds an assortment of bandannas, hand wraps, and some seasonally appropriate head and neck wear. After reading the book, I dumped out all the socks and underwear and folded them to Kondo’s specifications.

It is definitely an improvement. Previously I rolled socks together, which is not very efficient in terms of volume (and disrespectful to the sock, according to Kondo). The drawer was overfilling. A pair or two would frequently fall behind the back of the drawer, where I would forget about it until I happened to notice that the drawer was no longer closing all the way.

Folded this way, everything fits. Immediately upon opening the drawer I can take stock. As with all clothing categories, I have different types of socks and different types of underwear, each more or less appropriate for different applications. A quick glance in the drawer lets me know what I have available, and when it may be time to address the laundry pile.

Thrilling.

This post was published on . It was tagged with books, quote.

Terminal Weather

I do most of my computing in the terminal. Minimizing switches to graphical applications helps to improve my efficiency. While the web browser does tend to be superior for consuming and interacting with detailed weather forecasts, I like using wttr.in for answering simple questions like “Do I need a jacket?” or “Is it going to rain tomorrow?”

Of course, weather forecasts are location department. I don’t want to have to think about where I am every time I want to use wttr. To feed it my current location, I use jq to parse the zip code from the output of ip-api.com.

curl wttr.in/"${1:-$(curl http://ip-api.com/json | jq 'if (.zip | length) != 0 then .zip else .city end')}"

I keep this in a shell script so that I have a simple command that gives me current weather for wherever I happen to be — as long as I’m not connected to a VPN.

$ wttr
Weather report: 94107

     \   /     Sunny
      .-.      62-64 °F
   ― (   ) ―   → 19 mph
      `-’      12 mi
     /   \     0.0 in
...

This post was published on . It was tagged with linux.

Automated Repository Tracking

I have confidence in my backup strategies for my own data, but until recently I had not considered backing up other people’s data.

Recently, the author of a repository that I tracked on GitHub deleted his account and disappeared from the information super highway. I had a local copy of the repository, but I had not pulled it for a month. A number of recent changes were lost to me. This inspired me to setup the system I now use to automatically update local copies of any code repositories that are useful or interesting to me.

I clone the repositories into ~/library/src and use myrepos to interact with them. I use myrepos for work and personal repositories as well, so to keep this stuff segregated I setup a separate config file and a shell alias to refer to it.

alias lmr='mr --config $HOME/library/src/myrepos.conf --directory=$HOME/library/src'

Now when I want to add a new repository, I clone it normally and register it with myrepos.

$ cd ~/library/src
$ git clone https://github.com/warner/magic-wormhole
$ cd magic-wormhole && lmr register

The ~/library/src/myrepos.conf file has a default section which states that no repository should be updated more than once every 24 hours.

[DEFAULT]
skip = [ "$1" = update ] && ! hours_since "$1" 24

Now I can ask myrepos to update all of my tracked repositories. If it sees that it has already updated a repository within 24 hours, myrepos will skip the repository.

$ lmr update

To automate this I create a systemd service.

[Unit]
Description=Update library repositories

[Service]
Type=oneshot
ExecStart=/usr/bin/mr --config %h/library/src/myrepos.conf -j5 update

[Install]
WantedBy=multi-user.target

And a systemd timer to run the service every hour.

[Unit]
Description=Update library repositories timer

[Timer]
Unit=library-repos.service
OnCalendar=hourly
Persistent=True

[Install]
WantedBy=timers.target

I don’t enable this timer directly, but instead add it to my trusted_units file so that nmtrust will enable it only when I am on a trusted network.

$ echo "library-repos.timer,user:pigmonkey" >> /usr/local/etc/trusted_units

If I’m curious to see what has been recently active, I can ls -ltr ~/library/src. I find this more useful than GitHub stars or similar bookmarking.

I currently track 120 repositories. This is only 3.3 GB, which means I can incorporate it into my normal backup strategies without being concerned about the extra space.

The internet can be fickle, but it will be difficult for me to loose a repository again.

This post was published on . It was tagged with linux, backups.

The USB Armory for PGP Key Management

I use a Yubikey Neo for day-to-day PGP operations. For managing the secret key itself, such as during renewal or key signing, I use a USB Armory with host adapter. In host mode, the Armory provides a trusted, open source platform that is compact and easily secured, making it ideal for key management.

Setting up the Armory is fairly straightforward. The Arch Linux ARM project provides prebuilt images. From my laptop, I follow their instructions to prepare the micro SD card, where /dev/sdX is the SD card.

$ dd if=/dev/zero of=/dev/sdX bs=1M count=8
$ fdisk /dev/sdX
# `o` to clear any partitions
# `n`, `p`, `1`, `2048`, `enter` to create a new primary partition in the first position with a first sector of 2048 and the default last sector
# `w` to write
$ mkfs.ext4 /dev/sdX1
$ mkdir /mnt/sdcard
$ mount /dev/sdX1 /mnt/sdcard

And then extract the image, doing whatever verification is necessary after downloading.

$ wget http://os.archlinuxarm.org/os/ArchLinuxARM-usbarmory-latest.tar.gz
$ bsdtar -xpf ArchLinuxARM-usbarmory-latest.tar.gz -C /mnt/sdcard
$ sync

Followed by installing the bootloader.

$ sudo dd if=/mnt/sdcard/boot/u-boot.imx of=/dev/sdX bs=512 seek=2 conv=fsync
$ sync

The bootloader must be tweaked to enable host mode.

$ sed -i '/#setenv otg_host/s/^#//' /mnt/sdcard/boot/boot.txt
$ cd /mnt/sdcard/boot
$ ./mkscr

For display I use a Plugable USB 2.0 UGA-165 adapter. To setup DisplayLink one must configure the correct modules.

$ sed -i '/blacklist drm_kms_helper/s/^/#/g' /mnt/sdcard/etc/modprobe.d/no-drm.conf
$ echo "blacklist udlfb" >> /mnt/sdcard/etc/modprobe.d/no-drm.conf
$ echo udl > /mnt/sdcard/etc/modules-load.d/udl.conf

Finally, I copy over pass so that I have that available on the Armory and unmount the SD card.

$ cp /usr/bin/pass /mnt/sdcard/usb/bin/
$ umount /mnt/sdcard

The SD card can then be inserted into the Armory. At no time during this process — or at any point in the future — is the Armory connected to a network. It is entirely air-gapped. As long as the image was not compromised and the Armory is stored securely, the platform should remain trusted.

Note that because the Armory is never on a network, and it has no internal battery, it does not keep time. Upon first boot, NTP should be disabled and the time and date set.

$ timedatectl net-ntp false
$ timedatectl set-time "yyyy-mm-dd hh:mm:ss" # UTC

On subsequent boots, the time and date should be set with timedatectl set-time before performing any cryptographic operations.

This post was published on . It was tagged with linux, crypto.