New version of Zoom recording downloader

I just published new version of zoom-lomax. This is updated to use the v2 Zoom API, as v1 is going away at some point.
I run this every night so I can catch up on any meetings outside of my normal timezone the next day; it's proven very useful for me.


Open all links in Gerrit

Newer versions of Gerrit, somewhat insanely, lack the old "Open All" button to open each file in its own tab. Here's a bookmarklet that does so:
javascript: (
  function() {
    var n_to_open = 0;
    var dl = document.querySelectorAll(".pathLink");
    var dll = dl.length;
    if (!dll) {
      alert('no links');
    } else {
      if (confirm('Open ' + dll + ' links in new windows?')) {
        for (i = 0; i < dll; ++i) {
(Add the above as the "Location" of a bookmark.)


Adding an external NIC to a Triton compute node

I found it a little bit non-obvious how to use NAPI to add an external NIC to a compute node so it can reach the external network rather than just the internal admin one.

We need to first tag the underlying physical NIC on the compute node with the external NIC tag. We need to look up the MAC of the physical NIC:

computenode# # dladm show-phys -m ixgbe0
LINK         SLOT     ADDRESS            INUSE CLIENT
ixgbe0       primary  e4:11:5b:97:83:49  yes  ixgbe0
then tell NAPI (from the headnode) that this NIC is going to provide the external tag:
sdc-napic /nics/e4:11:5b:97:83:49 -X PUT -d '{ "nic_tags_provided" : "external" }'
We now need to actually add the external VNIC in NAPI:
cn=*your compute node UUID from `sdc-server list`*
ip=*IP address to use on external network*
vlan_id=*vlan id if any*

owner=$(sdc-useradm get admin | json uuid)

sdc-napi /nics -X POST -d @- <<EOF
 "owner_uuid": "$owner",
 "belongs_to_type": "server",
 "belongs_to_uuid": "$cn",
 "cn_uuid": "$cn",
 "ip": "$ip",
 "vlan_id": "$vlan_id",
 "nic_tag": "external"
After a while, we should find that the DHCPD server has updated the networking config file for the CN:
# cat /zones/$(vmadm list -Ho uuid alias=dhcpd0)/root/tftpboot/bootfs/e4115b978348/networking.json
  "nictags": [
      "mtu": 1500,
      "name": "external",
      "uuid": "86b73953-488a-4041-bd7a-83aa51c4ca22"
  "vnics": [
      "belongs_to_type": "server",
      "nic_tag": "external",
And on rebooting the CN, we can find our interface up, and reachable externally:
# ipadm show-addr external0/_a
ADDROBJ           TYPE     STATE        ADDR
external0/_a      static   ok 


Modifying boot files with SmartOS under Loader

With the advent of newboot in SmartOS/Triton, newly-installed systems will use loader as the bootloader, replacing grub. See RFD 156 for some technical background on the motivation of the switch.

It's often the case that people want to make some modification to an /etc file in subsequent SmartOS boots. As we boot from ramdisk, we can't just directly modify the files. As originally described on Keith's blog the way to get around this problem involves specifying specific files to over-ride the default.

Obviously this has changed under loader. Let's presume we want to over-ride /etc/system to set kmem_flags. First, let's take a copy of our file and edit it:

# sdc-usbkey mount
# mkdir -p /mnt/usbkey/bootfs/etc/ # or whatever
# cp /etc/system /mnt/usbkey/bootfs/etc/system    # or /mnt/usbkey/bootfs/dtrace.conf etc.
# echo "set kmem_flags=0xf" >>/mnt/usbkey/bootfs/etc/system
Now we want loader to prepare this file as a bootfs module. In grub, we used something like "module /bootfs/etc/system type=file name=etc/system". For loader, it's similar:
# cd /mnt/usbkey/boot
# echo etc_system_load=YES >>loader.conf.local
# echo etc_system_type=file >>loader.conf.local
# echo etc_system_name=/bootfs/etc/system >>loader.conf.local
# echo etc_system_flags=\"name=/etc/system\" >>loader.conf.local
The prefix (etc_system_) is fairly arbitrary, though often named after the module. For each file you want, you'd want a _load, _type, _name and _flag line specified. The _name entry is the path to the file for loader to use; the name flag is the /system/boot/... path you want the modified file to be available at after booting.

If this all worked OK, then we should see during boot something like:

Loading /os/20190207T125627Z/platform/i86pc/kernel/amd64/unix...
Loading /os/20190207T125627Z/platform/i86pc/amd64/boot_archive...
Loading /os/20190207T125627Z/platform/i86pc/amd64/boot_archive.hash...
Loading /bootfs/etc/system...
SunOS Release 5.11 Version joyent_20190207T125627Z 64-bit
Copyright (c) 2010-2019, Joyent Inc. All rights reserved.
WARNING: High-overhead kmem debugging features enabled (kmem_flags = 0xf)...
And we should find a copy of our modified file here:
# tail /system/boot/etc/system 
set kmem_flags=0xf


My awesome download manager

Since Liferea in more recent versions requires a download manager (it does not attempt to deal with the constant "new" podcast downloads on broken RSS feeds), I tried a few different different ones. None of them worked. The best of a bad bunch was uGet, but that still often got stuck on a busy loop, forgot where to download, failed to handle duplicates etc.

I realised that in fact the best option was this marvellous piece of engineering:

$ cat bin/download 


readonly LOG_FILE="/var/tmp/download.log"
touch $LOG_FILE
exec 1>>$LOG_FILE
exec 2>&1

#set -x

if grep "$1" ~/.downloaded >/dev/null; then
 echo "$(date): skipping $1"
 exit 0

echo "$(date): downloading $1"

echo "$1" >>~/.downloaded

cd $my_download_dir

curl -RksSLJO "$1" 
Not exactly stunning but it works.


wodim under Ubuntu

wodim/k3b are unusable on Ubuntu: after making sure you're in the cdrom group, you need to add to /etc/security/limits.conf:

@cdrom - memlock unlimited
(Or some limit, I suppose, if you're bothered.)