Mostly Helpful Stuff

Helpful Stuff

Free Carrots #7: How To Read Comics (2023/12/02)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

Jack Kirby illustration of The Thing

Comics piracy is a shambles. Bloated websites filled with malware, staffed by scan groups who delete perfectly good scans of actual comic books in favor of lazy rips from digital services that offer only modern computer recolorizations and high-contrast restorations of books originally printed on toilet paper before Michael DeForge was even born. Oh, and they love RAR archives (even RAR archives mislabeled as ZIP archives [and vice versa]). Luckily for us, the popular comics formats CBZ and CBR are literally just compressed folders of image files.

Which page(1) fully supports.

obtaining comics

The easiest way to obtain a comic book is to write and draw one during your free time. If you do it on 11" x 17" bristol board using india ink it will take you about a month and cost you about thirty bucks. That’s a dollar a day, which if you’re reading this you can almost certainly afford. If you lack the talent and drive to produce your own comic books, or maybe you can’t even afford the $1 cover charge, there are plenty of comic book scans everywhere on the Internet. They’re not all great quality, but then again neither are many of the issues and collections foisted on the public by publishers.

Stanley Lieber's amazon.com review of the LEGION OF SUPER-HEROES: FIVE YEARS LATER OMNIBUS

normalizing comics

You probably scanned your 11" x 17" bristol boards into a Mac and archived them as a CBR/RAR file. You may have even committed heresies such as putting spaces in your file names. This kind of crap complicates life on Plan 9.

Years ago I wrote my own naive hack to fix file names for Plan 9 file systems, called crip. It’s not a great program, but over time I’ve tweaked it so that nowadays it handles most everything I throw at it:

   ; crip -n     # fix all file names in this directory

Plan 9 doesn’t have any native tools for handling RAR archives, but it handles ZIP just fine. Someone wrote a small Go program called unrar (src, amd64 binary) that works well enough. I added logic to crip for automatically converting CBR files to CBZ:

   ; crip -c     # convert every CBR in this directory

read the fucking comic book

This is the easy part:

   ; page -w Love_and_Rockets_014_2023_digital_Lil-Empire.cbz

Read the page(1) man page to learn how to navigate, zoom, etc.

a comic book printed on toilet paper before Michael DeForge was born

bookmarks

You can create bookmarks by selecting snarf from page(1)’s mb2 menu and pasting the resulting string into a file. Add a plumbing rule to your $home/lib/plumbing like so:

   # handle page(1) bookmark strings
   type is text 
   data matches '(([a-zA-Z!0-9_\-.,/]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC|epub|EPUB|cb[tz]|CB[TZ]))!(.+)' 
   arg isfile    $1 
   data set      $file 
   attr add      addr=$4 
   plumb to none
   plumb start page -wij $0 $file

then cp it to /mnt/plumb/rules, and you’ll be able to open your bookmark by plumbing the string.

plumbing a page(1) bookmark from the sam(1) text editor

holding your heavy laptop sideways

reading LOVE AND ROCKETS V4 #14 on sl's MNT Reform

It’s really not so bad. Rotate page(1) and Use the arrow keys to navigate.

sl navigates a comic book in page(1) using the arrow keys

value proposition

The above method is indeed a bit complicated and obnoxiously labor intensive, but what I love about it most is the fact that it does not require another device or operating system besides a random laptop running 9front in order to read selections from my 512GB comic book collection, in this case stored on a tiny USB thumb drive that is easily maneuvered between systems while on the go.

Your mileage may vary!

MNT Reform with SanDisk USB thumb drive

Free Carrots #6: Tools For Fighting WiFi Inequality (2023/06/03)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

Intel 6205

Updated: 2023.07.13

The 9front FQA brazenly declares that the following Intel WiFi cards are supported by the iwl driver: 100, 1000, 2200, 2230, 3160, 4965, 5100, 5300, 5350, 6000, 6205, 7260, 8260, 8265, 9260, with the following supported by the wpi driver: 3945. Various users have reported over time that they do all work. But some of them seem to work better than others (the WiFi cards, not the users). Specifically, older cards exhibit far greater throughput than newer cards exchanging packets over the same networks.

Because I move between so many different machines, it has taken me a while to realize the intermittently bad WiFi performance conforms to a pattern.

What gives?

mPCIe cards are faster than M.2 cards

I’ve tested most of these cards in many different machines. Without exception, for reasons I don’t understand, I’ve observed that all known working mPCIe cards are much faster than all known working M.2 cards (save for one! See below), regardless of host machine or network.

What follows is an ad hoc demonstration wherein two different machines are connected to the Internet via WiFi sharing from my mobile phone. In both cases, the same remote OpenBSD box is mounted over sshfs(4), and the same files from that box are moved across the network, capturing throughput statistics with the tput(1) utility.

ThinkPad X60 Tablet w/ mPCIe Intel 3945:

   ; cat /n/rachael/usr/bin/* | tput
   0.00 B/s
   28.00 KB/s
   36.78 KB/s
   47.59 KB/s
   52.47 KB/s
   58.39 KB/s
   61.48 KB/s
   64.79 KB/s
   67.37 KB/s
   70.23 KB/s
   72.58 KB/s
   71.81 KB/s
   74.29 KB/s
   76.41 KB/s
   78.25 KB/s
   80.36 KB/s
   80.18 KB/s
   80.62 KB/s
   80.05 KB/s
   81.25 KB/s
   82.33 KB/s
   83.31 KB/s
   84.21 KB/s
   85.04 KB/s
   86.12 KB/s
   86.80 KB/s
   87.44 KB/s
   88.32 KB/s
   88.21 KB/s
   87.36 KB/s
   86.35 KB/s
   86.15 KB/s
   86.69 KB/s

Wow, so slow. Let’s see what happens if we use a much more powerful computer with a much newer Intel WiFi card:

ThinkPad X1 Yoga 3rd Gen w/ M.2 Intel 9260:

   ; cat /n/rachael/usr/bin/* | tput
   0.00 B/s
   0.00 B/s
   10.67 KB/s
   16.00 KB/s
   19.20 KB/s
   19.72 KB/s
   21.48 KB/s
   23.79 KB/s
   23.82 KB/s
   24.63 KB/s
   25.30 KB/s
   25.86 KB/s
   26.33 KB/s
   26.74 KB/s
   27.09 KB/s
   27.40 KB/s
   28.61 KB/s
   28.80 KB/s
   28.96 KB/s
   29.12 KB/s
   28.87 KB/s
   29.02 KB/s
   29.49 KB/s
   29.60 KB/s
   29.37 KB/s
   29.47 KB/s
   29.57 KB/s
   29.06 KB/s
   28.33 KB/s
   28.19 KB/s
   28.57 KB/s
   28.43 KB/s
   28.54 KB/s

Uh… what?

These results are consistent with all of my previous A/B comparisons between mPCIe and M.2 cards on myriad different computers and WiFi networks.

Why this sucks

9front WiFi is arbitrarily capped at 54mbps. This is in no way fast, but has proven sufficient for my own use case of running VNC over SSH (documented way back in Free Carrots #1). However, the above results for M.2 cards, which effectively means all mainstream laptops you can still get batteries for, are resoundingly insufficient to this and many other common tasks. 9P suffers with increased latency, souring the whole experience of using Plan 9.

Workaround

Update 2023.07.07: I told an inadvertent lie above, claiming that no M.2 cards are as fast as mPCIe in 9front. In fact, the Intel 6235 is an M.2 NGFF card, and turns out to be pretty fast. Years ago I had recorded this fact after installing one in my ThinkPad T431s, and then we even bragged about it in the body of a 9front release announcement. At some point I forgot it existed. One day, after writing the original version of this post, I was perusing old sysinfo entries and re-noticed the designation. I acquired another example, installed it in my ThinkPad X1 Yoga 3rd Gen, and it observed that it performs similarly to the mPCIe cards examined above. That is to say, it exhibits much faster throughput than any opther M.2 card I’ve tried.

Update 2023.07.13: 9front recently added support for the Intel 3160 (unlike the 6235, a member of the newer, 7000 family). This is also an M.2 NGFF card. I don’t have one, so I haven’t been able to test it yet. My tentative hypothesis is that it will perform badly, just like its similarly modern siblings.

So far, I’ve failed to find any other Intel M.2 cards besides the 6235 that are older than the 7260. So I guess we can recommend precisely one rare card to our users for their modern machines.

Workaround for the workaround

If you have a machine with an M.2 slot, need faster speeds, and don’t have an Intel 6235, or, in lieu of actual code fixes that add support for higher transfer rates to the existing iwl and wpi drivers, it’s always possible to fall back to an Ethernet to WiFi bridge. One major benefit of this approach, even on machines with the right combination of “fast” cards, is vastly greater speeds in general. For example, the IOgear GWU637 supports 300mpbs on 2.4GHz and works fine with every WiFi network I’ve tested it on. Just velcro it or something similar onto your machine and try not to trip over the cables.

ThinkPad X1 Yoga 3rd Gen w/ IOgear GWU637 Ethernet to WiFi bridge:

   ; cat /n/rachael/usr/bin/* | tput
   406.34 KB/s
   406.86 KB/s
   433.90 KB/s
   392.23 KB/s
   411.39 KB/s
   426.37 KB/s
   412.73 KB/s
   405.03 KB/s
   415.13 KB/s
   419.22 KB/s
   418.93 KB/s
   418.68 KB/s
   420.32 KB/s
   415.44 KB/s
   420.81 KB/s
   426.01 KB/s
   427.78 KB/s
   431.57 KB/s
   435.38 KB/s
   438.81 KB/s
   440.77 KB/s
   441.46 KB/s
   441.40 KB/s
   442.68 KB/s
   443.21 KB/s
   444.32 KB/s
   446.82 KB/s
   448.58 KB/s
   449.94 KB/s
   451.21 KB/s
   452.39 KB/s
   453.76 KB/s
   454.07 KB/s

Lo-res cats

Free Carrots #5: MNT Reform (2022/07/12)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

MNT Reform running 9front

Updated: 2023.07.07

MNT Reform is an 1.) expensive laptop that 2.) doesn’t spy on you. It doesn’t even have to run Linux, which, nowadays, can help with 2.). I bought one of these things last year, and suffered the indignity of running Linux regularly for the first time since the Clinton administration. (OpenBSD was not available for comment.)

9front developer cinap_lenrek also bought a MNT Reform, and so within a couple of months we had a mostly functional port of 9front to the device (sysinfo), which is featured in the current release.

Working: Graphics, Audio, Ethernet, WiFi, USB, PCIe, trackball.

Previously: Before WiFi was working, I used an IOgear GWU637 Ethernet to WiFi N adapter. This may still be preferable if 9front’s current 54MBps hard limit on WiFi is unacceptable.

Boot from sdcard

Occasional sdcard images are uploaded here:

http://9front.org/iso/

Unzip the image and use dd(1) to write the .img file directly to your sdcard. This image provides a full running system on the hjfs(4) file system.

Install to NVMe

If you’ve installed a compatible NVMe drive in your MNT Reform, one of the above images may also be used to install 9front directly to the NVMe. During the partdisk step, be sure to choose your NVMe drive as the install target.

Be careful not to accidentally overwrite your eMMC. Your nVME should be detected as sdN0, but if /dev/sdN0/linux exists, this may actually be your eMMC. Figure out what’s going on before you brick your Reform.

Note: You’ll still need to boot the kernel from the sdcard. Update plan9.ini on the sdcard’s DOS partition to point bootargs at your NVMe.

sysupdate

Update the source code on your running system via the usual sysupdate(1) command. Build from source to update your binaries.

Install new kernel

Slightly different than other platforms:

   ; cd /sys/src/9/imx8
   ; mk clean; mk install
   ; cd /sys/src/boot/reform
   ; mk
   ; 9fs dos
   ; fcp /arm64/9reform.u /n/dos/
   ; fcp /sys/src/boot/reform/boot.scr /n/dos/

Strictly speaking, installing a new boot.scr every time is not always necessary; but doing so will avoid gotchas when something important changes and nobody warned you ahead of time.

Build your own sdcard .img

After updating your source and building a new kernel (see above), do the following:

   ; cd /sys/lib/dist
   ; mk /tmp/9front.reform.img

This can be especially useful if you don’t want to compile things on your Reform (although, really, building 9front is not that slow even on this machine).

Configuring keyboard, screen, audio, etc.

Continuously updated, 9front-specific instructions on daily use:

http://plan9.stanleylieber.com/hardware/mnt/reform/

MNT Reform links

What is this thing, etc.? See:

buy, community, faq, ifixit, reform school, sl’s reform page

this cat is not stuck thank you

Free Carrots #4: Making Backups (2022/04/22)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

How does one perform incremental backups of the files stored on a Plan 9 file system? Haha, why would anyone ever need to do that?

Many years ago, as I contemplated migrating from UNIX to Plan 9, I needed a replacement for rsync. Fortunately, my transition was taking place while those of us trying to get 9front off the ground were doing some work on the installer and ISO, and I found myself face to face with an existing utility that covered about 90% of what I needed from rsync.

mkfs(8) copies files from one tree to another, copying only the files that are out of date (literally, when the timestamps don’t match), and of those, only the files that are included in the specified proto(2) file.

For example, this is how copydist in the 9front installer copies files from the install media to the user’s disk:

   ; disk/mkfs -z 16372 -U -s /n/dist -d /n/newfs /sys/lib/sysconfig/proto/allproto

This particular proto file contains only +, which copies every single file in the source tree to the destination tree. (This will be useful later.)

Perhaps more instructive is the proto file used to build the 9front ISO, /sys/lib/sysconfig/proto/distproto. It follows the same simple format, starting at the root of the tree and working its way down, specifying owner, group, and permissions at an arbitrarily granular level, like so:

   mode=ug+rw
   mode=o-w
   uid=sys
   gid=sys
   adm    d775 adm adm
          uid=adm
          gid=adm
          timezone      d775
                 *
   cfg    d775
          pxe    d775
   cron   d775
   lib    d775
          *
          audio  d775
                 icon   d775
                        *
          cmap   d775
                 *
          dict   d775
                 *
          face   d775
                 +

And so on.

It turned out that for my purposes, simply copying everything was enough. This is my one-line rsync replacement,

   ; disk/mkfs $args -v -z 4096 -s $1 -d $d <{echo +} >[2=1] | tee -a $log

extracted from my fully-operational, and very site-specific script:

http://plan9.stanleylieber.com/rc/backup

I’ve been using some variation of this script for going on ten years. Launched from cron(8) or executed manually for “quick” copying. It’s not exactly fast (see also: copydist), but it has served reliably for backing up website, mailing list, and other important data, preserving continuity over the years through several catastrophic server failures, and other, unnamed calamaties.

I agree. Slow is not great. Much faster is this third-party program written by kvik:

https://git.sr.ht/~kvik/clone

which uses parallel processes, similar to Plan 9’s existing fcp(1) command, but unlike fcp it also knows how to copy directories. Unfortunately, it does not yet know how to compare timestamps.

Help?

Update:

qwx has written a shell script that uses derp(1), awk(1), and tar(1) to copy changed files. The bonus here is that it also removes files that have been deleted from the source directory:

http://shithub.us/qwx/rc/HEAD/bin/syncab/raw

cat vs carrot toy

Concealed Carry III (2022/02/11)

Previously: Concealed Carry, Concealed Carry Redux

This blog has gone downhill. I used to write helpful posts, now I just brag about my gear. Over the past while I’ve adjusted my carry to reflect the ever increasing amount of tools, gadgets, and implements I carry around with me everywhere I go. It all makes writing posts like these possible, wherever I happen to be. Can you spot the error?

Backpack

5.11 Tactical Rush24 2.0

5.11 Tactical Rush24 2.0

I needed an even bigger bag. Yes, I said I was trying to consolidate. But this thing fits my very thick new computer (see below), all my books, folders, pens, brushes, cables, wires, radios, tools, etc., with plenty of room to spare. Thirty-seven liters. I’ve given this company hundreds of dollars over the years and only two zipper pulls have ever broken off. They’re well ahead of the game.

Main pouch contents:

I said all that stuff about switching to earbuds last time. I really tried. After an extended period of testing many different alternatives, I stumbled across these relatively reasonably priced, over-ear, open-back headphones. I know, it sounds stupid; open-back headphones are transparent to external noise. But these really are the best sounding headphones I’ve ever heard. Thanks to my new backpack I was able to make room for them.

Similar story with the computer. That is to say, I’m once again carrying one around in my backpack. After a period lugging a 15" ThinkPad T60p (my favorite computer ever) from location to location, I bought this:

MNT Reform

Unchanged since last time:

Front pouch contents (top):

Front pouch contents (bottom):

Side pouches:

Rolling Case

Pelican 1510 Protector

Pelican 1510 Protector

I have to store my legitimate work tools somewhere.

Concealed Carry Redux (2021/08/04)

Previously: Concealed Carry

Be advised, things change. Prince became a Jehovah’s Witness. Metallica met Bob Rock. I needed to carry more stuff while at the same time reducing the overall bulk and weight of my carry (my back is junk). Following is an incomplete list of changes to all the stuff I somehow manage to haul around with me every day.

Backpack

5.11 Tactical Rush12

5.11 Tactical Rush12

All those scary patches I used to have on my bag? Nobody took the bait. And maybe that’s okay.

One security guard keeps asking me if these examples of old Bell System flare are Boy Scout patches.

Messenger Bag

5.11 Tactical Rush Delivery Lima

5.11 Tactical Rush Delivery Lima

The Mike was too small to carry real books. (Did I mention something about reducing bulk and weight?) Enter the Lima, exactly the same design, but with larger internal dimensions. These are good, but I think they’ve been discontinued.

Right pouch contents:

Over-ear headphones were a luxury that took up too much space in my backpack. In-ear monitors (IEMs) are a reasonable compromise. Because Bluetooth is a goat circus, I’ve switched to a wired alternative.

Apple iPad Pro 11" (2021)

Back pouch contents:

Yeah, I know. My crazy 51nb ThinkPad X210 ended up being impractical to carry. I tried to replace it with a fourth-party 51nb ThinkPad X62, which arrived DOA from an unsympathetic Chinese seller. Which is just as well, since it wasn’t going to save me much in the way of size and weight, anyway. For maximum flexibility with my current multimedia and not-always-within-WiFi range activities, I’ve once again resorted to an iPad with an internal “5G” radio. To my surprise, I’ve managed to get a three-button USB mouse, and VNC+SSH to my 9front system working well enough to compose this post with same. Maybe by the time the Pine Tab is available again it will be able to boot a real operating system. In the meantime, I’m recording music again.

5.11 Tactical Rush Delivery Lima - interior

Interior contents:

ReMarkable RM102

Free Carrots #3: Additional Software (2021/01/27)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

For once, application development on 9front is outpacing OS development. It can be hard to keep up, especially if, like myself, you hardly ever find yourself sitting in front of a computer. The following is a list of interesting recent projects by 9front users that are not currently included with the 9front distribution.

9pzone - Public registry service for 9p services, OS agnostic.

bar - Displays battery, date and time in a small, auto-topping bar placed in a corner of the screen.

castor9 - Surf gemini pages in a GUI.

gemnine - Surf gemini pages in a text window.

minivmac - Boot a Mac on 9front instead of booting 9front on a Mac.

neindaw - DAW as a file system (use with orca).

netsurf - APE port with Plan 9 native frontend. Works.

orca - ORCΛ for Plan 9.

picker - Color picker.

rc-gemd - Serve gemini pages.

rio live theming with /dev/theme - It’s not treason (see below).

riow - Virtual desktops and window management (like dwm).

treason - Video player. Can be used to view YouTube videos.

whiteboardfs - Collaborative drawing.

zuke - Music player. Like juke(7), but good.

cat playing with a carrot

Free Carrots #2: TLS boot over WiFi (2020/05/13)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

Picture it: My desk, some years ago.

Lenovo ThinkPad X301

I didn’t really feel comfortable leaving my data lying around where it might be confiscated, but at the same time I wanted to 9front while I was supposed to be working. Fortunately I had remembered to bring my bootable USB stick, and some helpful soul had plugged a WiFi router into the U-Verse in the break room.

Back then 9front didn’t have TLS booting over WiFi, but it does now. The following explains how to set it up, obviating the need for all the crazy-ISO-tricks I used to pull, back in the day.

First, configure your file server to listen for network connections. This will cause the machine to listen on port 564 (by default, the system is already running a TLS listener that bounces incoming TLS connections to port 564).

Next, your client (the machine that is TLS booting over WiFi) needs only a few alterations to its plan9.ini:

   bootargs=tls
   ether0=type=YOUR_WIFI_DRIVER_HERE essid=YOUR_WIFI_AP_HERE
   wpapsk=YOUR_WIFI_PASSWORD_HERE
   auth=8.8.8.8
   fs=8.8.8.8

Note: Your auth and fs machines are not really Google DNS servers.

The boot scripts will attempt to authenticate to the WiFi access point specified, and then obtain an IP address via DHCP. The auth and fs servers listed will be used to access the remote environment.

To bypass DHCP, arguments to ipconfig(8) may be entered on the bootargs line:

   bootargs=tls!-g 192.168.0.1 ether /net/ether0 192.168.0.23 255.255.255.0

That’s all there is to it, but curiously for some reason I never actually tried it until this week.

Anyway, it works.

Free Carrots #2: TLS boot over WiFi

Free Carrots #1: VNC over SSH (2020/05/06)

Free Carrots is an ongoing series of helpful tips for using Plan 9.

The canonical teaching tool for demonstrating Plan 9’s private name spaces and file interfaces is this:

   deckard; bind /net/tcp /proc
   deckard; ps
   qin               0    0:00   0:00        0K 0        Listen
   qin               1    0:00   0:00        0K 0        Listen
   qin               2    0:00   0:00        0K 0        Listen
   qin               3    0:00   0:00        0K 0        Listen
   qin               4    0:00   0:00        0K 0        Listen
   qin               5    0:00   0:00        0K 0        Established
   qin               6    0:00   0:00        0K 0        Established
   qin               7    0:00   0:00        0K 0        Established
   qin               8    0:00   0:00        0K 0        Established
   qin               9    0:00   0:00        0K 0        Finwait1

The value of this example is not that the result itself is especially useful, but that the design of the system almost inevitably produces tools that can be reused in new and surprising ways, sometimes without modification.

In Plan 9, you get a lot for free.

Another popular demonstration is borrowing the network stack of a remote machine:

   deckard; cat /net/iproute
   0.0.0.0         /96  192.168.1.254   4    dhcp   0 192.168.1.0     /120
   0.0.0.0         /96  192.168.1.254   4    dhcp   0 192.168.1.230   /128
   192.168.1.0     /120 192.168.1.0     4i   ifc    0 0.0.0.0         /96 
   192.168.1.0     /120 192.168.1.0     4i   ifc    0 192.168.1.230   /128
   192.168.1.0     /128 192.168.1.0     4b   ifc    0 192.168.1.230   /128
   192.168.1.230   /128 192.168.1.230   4u   ifc    0 0.0.0.0         /96 
   192.168.1.255   /128 192.168.1.255   4b   ifc    0 192.168.1.230   /128
   255.255.255.255 /128 255.255.255.255 4b   ifc    0 192.168.1.230   /128
   deckard; rimport mars2.inri.net /net
   deckard; cat /net/iproute
   0.0.0.0         /96  216.126.196.33  4    none   0 216.126.196.32  /123
   0.0.0.0         /96  216.126.196.33  4    none   0 216.126.196.35  /128
   216.126.196.0   /128 216.126.196.0   4b   ifc    0 216.126.196.35  /128
   216.126.196.32  /123 216.126.196.32  4i   ifc    0 0.0.0.0         /96 
   216.126.196.32  /123 216.126.196.32  4i   ifc    0 216.126.196.35  /128
   216.126.196.32  /128 216.126.196.32  4b   ifc    0 216.126.196.35  /128
   216.126.196.35  /128 216.126.196.35  4u   ifc    0 0.0.0.0         /96 
   216.126.196.63  /128 216.126.196.63  4b   ifc    0 216.126.196.35  /128
   216.126.196.255 /128 216.126.196.255 4b   ifc    0 216.126.196.35  /128
   255.255.255.255 /128 255.255.255.255 4b   ifc    0 216.126.196.35  /128
   fe80::          /64  fe80::          6i   ifc    0 fe80::5054:ff:fe09:9935 /128
   ff02::          /16  ff02::1         6m   ifc    0 fe80::5054:ff:fe09:9935 /128
   ff02::1         /128 ff02::1         6m   ifc    0 fe80::5054:ff:fe09:9935 /128
   fe80::5054:ff:fe09:9935 /128 fe80::5054:ff:fe09:9935 6u   ifc    0 fe80::5054:ff:fe09:9935 /128
   ff02::1:ff09:9935 /128 ff02::1:ff09:9935 6m   ifc    0 fe80::5054:ff:fe09:9935 /128

Now, any network connections leaving deckard from within this namespace will be routed through the encrypted connection to mars2 before they hit the outside world.

Many tools in 9front have been rewritten or otherwise created from scratch to satisfy user (read: developer) requirements, including a modern SSH client. The peculiar features of the operating system as described above suggest an opportunity to combine facilities in such a way that enables a more-or-less free capability to borrow the network stack of operating systems other than Plan 9.

Enter sshnet(4), which, you guessed it, allows for importing the network stack of another operating system over SSH.

   deckard; sshnet rachael.inri.net   # borrow network stack from openbsd machine
   deckard; ls /net     # iproute not implemented, but needed files are present
   /net/cs
   /net/tcp
   deckard; window -m vncv 192.168.1.22:0    # vnc to host behind rachael

Note that any other program on the system can also take advantage of this makeshift VPN without having to know anything at all about the SSH tunnel.

Together, ssh.c and sshnet.c comprise less than 3,000 lines of code.

Free Carrots #1

Concealed Carry (2020/03/05)

Everything I use I have to carry with me. That means paper books are usually out of the question. But I do manage to lug around quite a lot of other useful tools, toys, and materials. It helps to conceal it all inside socially low observable prop gear. No one questions this stuff because either they believe I’m on their side, or they’re afraid I’ll mention politics. Owing to differences in geography and climate, YMMV.

It all adds up to only two bags, which I can actually lift, even with my compromised back. This is my roving office, from which I create comics, zines, and write blog posts such as the one you’re reading right now.

Backpack

5.11 Tactical 56892

5.11 Tactical 56892

Upper pouch contents:

5.11 Tactical 56892 - lower pouch

Lower pouch contents:

5.11 Tactical 56892 - top pocket

Top pocket contents:

5.11 Tactical 56892 - interior

Interior contents:

Messenger Bag

5.11 Tactical 56176

5.11 Tactical 56176

Left pouch contents:

Right pouch contents:

5.11 Tactical 56176 - back

Back pouch contents:

5.11 Tactical 56176 - interior

Interior contents:

Side pocket contents:

OK, china. (2020/02/19)

I bought a unihertz Titan to replace my BlackBerry Passport. Nagging complaints about the Passport included: short battery life, flaky Qi charging, terrible cameras. Complaints about the Titan include: Android, the unit itself is heavy (with sharp edges around the case), and also, Android. I’m not sure yet which is worse. The Titan does offer some pleasing upgrades: IP67 dust/water resistant, good battery life, Qi charging works well, wider range of working/performant Andoid apps. But it’s still Android.

I’m documenting my experience. I’ve posted some tips on the device’s quirks and workarounds here.

How To View The Web From 9front (2019/12/05)

The World Wide Web is a wretched hive of scum and villainy, a fact all too familiar to refugees from the old Internet. September merged with IRL, and now everyone who was busy telling you to go outside and play for the past twenty-five years can’t be convinced to put down their phones. Sorry, teacher’s pets, but government and big business are both in on the scam. Dangers abound, and navigation is fraught with opportunities for disaster. Fortunately, some browsers don’t support Javascript or CSS.

mothra(1)

Enter mothra(1). Written in 1995 as a toy for the 2nd edition of Plan 9, mothra doesn’t support <div> tags, color attributes, or even fonts beyond bold, italics, underline, and fixed width. When 9front developers discovered it tucked away on the old Bell Labs server (mirror), it was no longer even shipped with Plan 9. Since that time, some work has been done on it.

First was stopping it from printing the HTML version at the top of each document. Haha. The first fundamental change was to rip out all the network code (sorry, ftp:// lovers), and cause it instead to rely upon webfs(4), which brought it into line with all the other HTTP-eating programs in 9front. Next was implemented moth mode, empowered by the addition of a generic text entry box to event(2), which allowed for nibbling chunks out of web pages and saving them with arbitrary file names in arbitrary locations on the file system. Finally, text selection and copy/paste was added. Future improvements are planned to include a Plumb menu option, and easier customization of the browser’s default appearance.

webfs(4)

9front’s webfs(4) was re-written from scratch. The program is a file server that takes requests from local programs (yes, even shell scripts), contacts remote HTTP serveres, and returns the results. Its user-agent string is configurable. You’re probably already thinking of uses for it.

mothra sends requests to webfs and renders the results as a graphical web page.

Honestly

mothra does a pretty good job of rendering basic HTML, but many web pages have such wonky formatting, or otherwise rely so heavily upon CSS for layout, that sometimes quite a lot of vertical scrolling is required to get past the initial burst of banners, affiliate links, and menus. While some sites are irretrievably shitted up with mandatory Javascript, many still fall back to a relatively sane presentation via an RSS feed, which it turns out is the most efficient conduit for spraying web content onto your 9front screen.

hget(1)

Sidebar: Maybe you don’t really need to see images or click on interactive links. Ever heard of curl(1) or wget(1)? 9front’s re-written hget(1) offers a similar bag of tricks. Using hget and its companion tools, it’s even possible to fill out web forms from the command line. That’s right, say it again: everything is scriptable.

RSS/Atom

Anyway. Through some extended acrobatics it’s feasible to pull RSS feeds and deposit them into a format mothra can handle. A conveniently extant Go program called rrss runs independantly of webfs (the RSS parsing library it uses handles HTTP requests all by itself), and translates them into either human readable plain text, or a blog format compatible with werc (via its third-party barf plugin).

9front ships with most of what you need to build this self-contained RSS feed reading setup. The rest is easily installed. You can run everything on one machine, or you can pull the feeds to a remote 9front server and then surf to them from anywhere you want in whatever browser you choose. Do all of this:

That’s everything you need.

Configure cron(8) to periodically run rrss against a list of RSS feeds. This, too, is best customized with a shell script. It looks like I haven’t made significant changes to my script in over over four years so it must be doing something right.

Put something like rrss.barf in your $home/bin/rc/:

   #!/bin/rc
   # Dump RSS feeds into werc/apps/barf entries.
   # Run from cron.
   rfork en
   name=$1
   names=(read tumblr)
   log=$home/lib/$name.err
   root=$home/www/werc/sites/$name.stanleylieber.com
   urls=$home/lib/$name
   if(! ~ $name $names){
          echo guess again. >[1=2]
          exit usage
   }
   rm $log
   >$log
   chmod +at $log       # +t so this file isn't copied to the dump.
   # go used to hang a lot, so we erect a safety net.
   {
          while(){
                 sleep 30
                 if(ps | grep -s -e 'Broken[ ]+rrss'){
                        {date; echo Kill Broken rrss} >>$log
                        Kill rrss | rc
                 }
          }
   } &
   ofs=$ifs
   ifs='
   ' {
          for(i in `{cat $urls}){
                 ifs=$ofs {
                        j=`{echo $i}
                        url=$j(1)
                        tag=$j(2-)
                 }
                        alarm 60 rrss -f barf -r $root -t $"tag -u $"url >>[2]$log
                        echo $"url $"tag >>$log
          }
   }
   for(i in `{f $root/src}){ chgrp www $i }
   {date; echo Kill rrss.barf} >>$log
   Kill rrss.barf | rc

And in /cron/$user/cron:

   1 1,3,5,7,9,11,13,15,17,19,21,23 * * * local rrss.barf read
   1 2,4,6,7,8,10,12,14,16,18,20,22 * * * local rrss.barf tumblr

The files $home/lib/read and $home/lib/tumblr are lists of RSS feed URLs (one per line), and $home/lib/read.err, etc., contain any errors encountered when the script is run by cron.

When you surf to your barf page (in mothra or otherwise) a convenient heading will indicate the total number of feed items pulled. After logging in to barf, each item will likewise be accompanied by a button you can clicked to delete the item from your disk.

Conclusions

Voila. I’ve been getting by this way for several years. Surviving, if not living (as my mother used to say). Obviously, mothra is no one’s conception of an ideal browser, but then again the web is no one’s conception of an ideal mechanism for delivering content. At the end of the day at least I’ve imposed these usability constraints upon myself.

Pros:

Cons:

I used to be able to track Twitter and Instagram via RSS. Both have resorted to repeated and extensive measures to prevent humans from interacting with their services without first logging in via an approved client running on an approved operating system. Which obviously is the exact opposite of what I’m trying to do here. Only one of the several reasons I gave up on these services. Tumblr, and some other failed extraction operations, still offer RSS feeds.

Maye some of this is a blessing in disguise.

You Surrender

I know, this sounds like a lot of trouble to go through just to end up with diminished functionality on an operating system you’re probably only running in a virtual machine anyway.

If by some unlikely confluence of irregular events you are actually running 9front on bare metal, and you just can’t take it anymore, and life is starting to look bleak without access to 8chan’s AI-training captcha, you can always install OpenBSD or Linux in vmx(1).

I understand. At least you’re trying.

I won’t tell if you don’t.

How I Switched To Plan 9 (2019/12/03)

Background

Hi, I’m SL. You may remember me from my classic appearances in contentious 9fans threads, or maybe you’ve read one of my books.

I’m a veteran UNIX admin of 20+ years. I produced a bunch of multimedia stuff on a Macbook in the mid-2000s. I ran 9front on all my production servers and on my personal laptop (my main personal computer) almost exclusively from 2011 to 2017. In early 2017 I moved to a new job that involved a lot of traveling and infrequent access to WiFi. It also turned out that carrying a second laptop (besides my work laptop) added too much bulk/weight to all the stuff I already had to carry everywhere I went. I bought one of those early iPad Pros equipped with an LTE connection and did most of my necessarily mobile computing via that device for the better part of two years. I was able to rig up a command line connection to 9front using a native iOS SSH client and drawterm -G. I explained how this was accomplished in a previous blog post. Infrequently, I carried a ThinkPad X230 Tablet, and later a ThinkPad X250 along with me, piggybacking off the iPad’s WiFi tethering.

The experience sucked. Replacing a general purpose computer with a jacked-up surveillance sensor package is not my idea of solving the problem of mobile computing. Lugging around extra pounds put a lot of strain on my already compromised back. Something had to give.

No pun intended.

Recently, I acquired a used ThinkPad X1 Tablet (1st Gen). This thing is small enough to fit in my bag, works well with both OpenBSD and 9front, and weighs almost as little as my iPad Pro with it’s folding keyboard cover. Finally, I’m back in business.

What Plan 9 Does For Me

Plan 9 excels at text manipulation. Conveniently, the entire system is controlled via text interfaces. Private namespaces ratchet this up into something even an idiot like me can use to construct efficient workflows.

I can’t understand something presented to me that’s very complex. – Ken Thompson

With the exception of multimedia and the modern web, all my needs are met. Pretty much anything people do with traditional UNIX terminals can be done at least as efficiently from a Plan 9 window. Even one accessed over SSH from an inferior operating system.

Is there support for playing audio (MP3, FLAC, etc.)? Yes.

Is there support for playing video? No.

Read this incomplete list of commonly requested software that ships with 9front: http://fqa.9front.org/fqa1.html#1.8

Watch this introductory video: https://youtu.be/6m3GuoaxRNM

Any more questions?

Spoiler: If you don’t care about my personal experience you can skip this blog post and proceed directly to the 9front Frequently Questioned Answers (FQA) section on using 9front, here: http://fqa.9front.org/fqa8.html. The information is more technically informative but lacks the endearing flavor of my personal bullshit.

Text Editing

I started trying to use Plan 9 in 2009. I had been editing tons of PHP code in OpenBSD using vi(1). A lot of fighting with cut and paste. In the midst of this gargantuan project at work I was reading my way through http://cat-v.org for the first time. I decided to give sam(1) a try.

It was love at first sight. I never wanted to go back, and consequently I didn’t. Here was the solution to my distaste with ex: structural regular expressions. I started out running the (at that time) very old portable version of sam in the OpenBSD ports tree, then ended up installing Plan 9 in QEMU, using the entire operating system as a glorified IDE. Wait, vi who?

I’m tired of using vi. – Bill Joy

Me too, buddy.

IRC

Programming from within Plan 9 naturally led to me wanting IRC and my text editor on the same screen at the same time. Luckily, there were several IRC clients to choose from. The simplest of which, ircrc, was a shell script. Remember that for later. Owing to Plan 9’s file interfaces, private namespaces, and modular design, much of the system is effectively built out of shell scripts.

Note: This would be a good time to familiarize yourself with Brian Kernighan and Rob Pike’s seminal The UNIX Programming Environment. I re-read it at about this time, and felt like I was really starting to understand it for the first time. Unlike modern UNIX, Plan 9 satisfies all the demands made by TUPE.

ircrc was fine, but eventually I wanted a persistent client, something that better approximated irssi running in tmux on a remote shell server. This desire coincided nicely with my first attempts to setup a permanent Plan 9 server. I found what I was looking for in irc7, a client split into its own client/server components, with one part holding open a persistent connection to an IRC server on an always-up Plan 9 machine, and the other part serving as my interface to IRC on my personal machine, whenever and wherever I happened to be located.

E-mail

I found that I was spending more and more time in my Plan 9 installation in QEMU, and less and less time in UNIX proper. The next natural desire was getting e-mail into the mix. At this point I was still using Google’s gmail product, which I was able to access over IMAP using Plan 9’s native upas mail subsystem. I was shocked to discover that upas dated from 1984. (Footnote: It was not susceptible to the Morris worm.)

After a while I decided I didn’t want to be used by gmail anymore, so after many years I resumed hosting my own e-mail using the aforementioned upas' SMTPD and SMTP mechanisms. Yes, I’m still able to access my mailboxes over IMAP from whatever computer or device is readily at hand, or by simply logging in to the remote Plan 9 server and running mail(1) like a normal human being. One benefit of receiving mail on Plan 9 is that I’m able to configure spam filtering, mailing list sorting, autoresponders, etc., using the same kind of simple shell scripts that control the rest of the system. Here, again, learning the fundamentals pays dividends throughout the experience. It’s almost as if time spent learning one part of the system can be profitably applied elsewhere. As a heavy computer user for over thirty years, this still strikes me as suspiciously sensible.

WWW

9front ships with two web browsers, both written as jokes and abandoned by their authors in prior decades. Neither of them support Javascript, CSS, or anything beyond a meager subset of HTML. Of the two, 9front’s evolution of Tom Duff’s mothra(1) is perfectly usable if the aforementioned Rube Goldberg extensions are not required. Trying to use Plan 9 but still needing a modern web browser is a conundrum that has inspired many fledgling Plan 9 users to give up hope and retreat to the safety of their Macbooks. (See also: 9fans)

By the time I was ready to ditch the host operating system and install Plan 9 on bare hardware, my desire for the modern web experience had ebbed to an all time low. I went several years only touching a featureful browser when absolutely necessary. Which always felt gross. Your mileage may vary.

Torrents

9front ships with a native torrent client that works very well but does not support magnet URLs. For a long time this didn’t bother me because magnet links were (unlike today) not often required, and in any case, I could always just use a UNIX machine to perform the download. At some point the sheer inadequacy of this excuse began to wear thin. Why did I want to be forever tethered to UNIX? I finally got rid of the modern web browser, and now this? Usefully, Plan 9 became a first class citizen in the Go programming language community. Some Go torrent clients actually work on Plan 9.

Note: Plan 9 may not be used to download legally encumbered material without the express permission of the rights holder.

Making Books

At the end of the day, what do I actually do with my computer?

I’m a writer. I write books. I use Plan 9 to type, format, collate, and prepare camera ready output for those books. Just like Brian Kernighan with his Linotron 202 (and, I should add, using many of the same software tools.)

Some examples of the build process include:

https://code.9front.org/hg/fqa.9front.org

https://code.9front.org/hg/1oct1993

https://code.9front.org/hg/thrice_great_hermes

Start by reading each mkfile.

Is That It? I Gotta Go.

Seriously, what do you do with your computer?

Over time 9front sanded off its rough edges. I can do just about everything I need to do from a bare metal install. Today, we even have vmx(1) for hosting OpenBSD or Linux virtual machines (just in case you need to interface with the U.S. government via the now-required modern web browser). A previous release of the 9front DASH1 manual was created entirely on a ThinkPad running 9front (and Gimp running inside OpenBSD running inside vmx(1)). 9front now even ships with a primitive Microsoft Paint clone, several native Sega and Nintendo emulators, and a full port of DOOM. I never would have dreamed anything like this was possible back in 2009. As time goes by, there is less and less reason to boot anything else.

For what I do, I’m perfectly happy with it.

Hermes Rocket (2018/09/24)

Hermes Rocket, 1952

Typewriters can be useful. Specifically: lightweight, portable typewriters such as the Hermes Rocket provide a convenient, reliable alternative to computers. Type and file.

They may also ship with unique baggage:

The man who owned this typewriter was a US Air Force officer and engineer, who was principal designer of the SR-71 spy plane engines. Threaded up around the platen of this machine when I received it was a seemingly blank sheet of paper that revealed, upon careful inspection with a bright desk lamp, the imprint of some official military correspondence.

Update, 2019:

Sold the old (1952) model, and bought a slightly newer (1955) model. It’s in better condition.

Hermes Rocket, 1955

Install Classic Keyboard on xx30 Series ThinkPads (2018/04/16)

Lenovo ThinkPad T430 with T420 keyboard

This guide will explain exactly how to replace your xx30’s keyboard with an xx20 Classic keyboard.

Read more here.

Additional information here.

Even more information here.

Dealing with webshit: Configuring Firefox (2018/03/23)

This is the bare minimum necessary to configure Firefox so that it behaves in a reasonable manner. This document was last updated on 27 January 2017 and was tested with a clean install of Firefox 57. Verify these steps each time Firefox is updated.

Read more here.

Connect to Plan 9 from a mobile device (2018/03/08)

Help, my phone is my only Internet access

This article describes how a mobile phone (in this case, an iPhone) may be used to quickly and easily access a Plan 9 computer. Note: The path to victory is littered with compromises of necessity that terminate in reasonable functionality. Your mileage may vary.

SSH client

Any SSH client will do.

For iOS, there exists an app called Prompt 2 by Panic, Inc., whose features are sufficient to the task. Prompt 2 may be configured for one-click connection to a remote server, including the ability to automatically run a command once the connection is established (see below).

Remote UNIX SSH server

The following platforms are recommended: OpenBSD, FreeBSD, Solaris, MacOS. Other UNIX-like systems may also be able to compile and run drawterm (see below).

Terminal multiplexer

A terminal multiplexer such as tmux(1) may be used to sustain a drawterm connection across numerous SSH sessions. For convenience, create a script to re-attach your session that may be executed by the SSH client:

   #!/bin/sh
   tmux -u attach

drawterm -G

The 9front project has forked and updated Russ Cox’s original drawterm:

http://drawterm.9front.org

adding (among other things) support for a non-graphical, text-based command line mode:

   drawterm -G -h $host -a $auth_server -u $user

The drawterm command is likewise suitable for being run from a script.

Go!

All the pieces in place, configure your SSH client to connect to the remote UNIX SSH server and re-attach to your tmux(1) session.

Prompt 2 running on an iPhone 7 Plus

Related: 9front, Plan 9

mother (2017/11/29)

Mother is an rc(1) script that provides a similar experience to nedmail(1). Note: saved messages are copied manually to the mbox directory in mdir format (the default used by Erik Quanstro’s nupas and 9front’s upas). All other interactions between mother and mail messages occur via upasfs(4).

Read more here.

Related: 9front, Plan 9