QZ qz thoughts
a blog from Eli the Bearded
Tag search results for hacks Page 1 of 3

Note to Self


In the communication tool Slack (app and web versions of a modern IRC type system), one can send direct messages to people or bot accounts, and also send direct messages to oneself.

Slack bills the direct messages to self as "Jot something down" and it has a little bit of use as a notepad for remembering something. Originally I mostly used it for testing formatting of messages, after which I could cut and paste a proof-read and correctly formatted message to another place.

But recently I have found that the most useful thing I get out of direct messages to myself is very fast transmission of short messages to other devices. In particular it is a great way to send a link privately from one computer to another when both sit on the same desk but on different VPNs. It's faster than email by a long shot, and faster (but perhaps because I am already logged in on both systems) than many other web storage methods, like Github Gist or similar.

For space reasons, I've found that some links are best "code" quoted using backticks like one would for inline preformatted text in markdown. Those links are clickable but do not expand with a preview pane.

Speaking of "clickable links", there's a new Unicode Toy now, the Interleave Whitespace tool. My initial use case was "easily adding zero width spaces (zws) to things to break automatic linkage. After some thought, I decided to generalize it to adding and removing whitespace. Stripping zero width characters from text is hard to do manually, and normalizing whitespace that can include non-breaking spaces, zero width spaces, special sized spaces like hair space or em quad, is marginally difficult and very tricky if you are working with just a few words for a Slack message or Tweet.

vi and tags


The vi editor, and the significant vi-clones, as well as Emacs and other editors, support a thing called a "tags file". It's essentially a set of bookmarks or a book's "Index" section fore text files.

The intended use is you run a program that indexes your source code and creates the tag entries for you. For example, with ctags you can run it and have it scan source code in dozens of languages (not just C-like ones, such as Java and Go, but also Postscript, Fortran, and others) and produce a file that tells the editor how to find function and variable declarations. (For Emacs, use the etags program to similar effect.)

The tags functionality is very useful when editing code. I keep tags files in source directories for all of my multi-year projects. You can begin and edit session by running vi -t pickle to open the editor to the file and line that pickle() is defined. Say inside pickle() you find a call to spices() and want to know what it does, position your cursor in the word and hit <ctrl-]>, you jump there. Return to where you were with a :pop. Without the keyword handy to <ctrl-]> upon, you can instead :tag spices as well.

For people using vim as their vi of choice, it might help to know that the entirety of the :help system is built using tags, just slightly tweaked for where to look for the tags file. If you know how to use help in Vim, you know how to use tags. And :help tags can probably teach you something you didn't already know about them.

The tags files are a little more mysterious. Normally people don't create or edit them by hand, but you can or you can create programs to create them for your own special needs.

The basic format, and all I'll cover here, is a text file with three tab separated columns. The first column is the tag name, eg pickle. The second column is the file name, relative to where the tags file is located. The third column is a ex-mode movement within the file. Usually the movement is a search, something like /^int pickle(recipe_t rec)$/ that will unambigously find a single line in the file. But line numbers also work just fine. And search with line number offset works for niche needs, eg /^int pickle(.*)$/+2 to start out on the variable declarations if your syntax looks like the following sample. With :set scrolloff=3 to put some space above the cursor, it may be more useful for you.

#include "brine.h"

int pickle(recipe_t rec)
{
    long     cuke;
    int      salt;
    spices_t spicing = spices(rec);

    /* ... */
}

In traditional vi any command you could put on a : line would work in the movement column, including things like :! rm *. I know Vim has tightened that, and I believe the other vi-clones have as well. If Vim doesn't like any movement in a tags file, it will ignore the whole file.

One trick I have found useful is programmatically generated tags files created with a wrapper program. Rather than have a giant file with all tags, I have a database that I can query and then it generates a tags file (with a single entry) and invokes vim -t main to jump to the exact file and line for me. This can make my query easier to form than remembering a specific tag keyword and does not involve a large flat file with huge redundancy.

whirr-click-click-click whirr-click-click-click-click


Justine Haupt has built a very impressive rotary cellphone for herself. It's stunning. Impressive. Clever.

And not at all what I want in a phone.

For years I avoided getting a "smart" phone and made do with the low-end of the market. A Nokia slab. An Audiovox flip phone that would not die, but was carrier locked. A Samsung flip phone that I could use on the "family plan".

I never found the phone I really wanted. I still haven't seen it. But I did find a phone that I found really cool. And I got that.

What I want from a phone is basically extreme rugged construction plus fully open source, and upon seeing Ms Haupt's work I feel I should also add in "and gives me a decent Unix shell". I experimented with a Firefox Phone as a wifi-only device. It was okay software-wise, but clearly needed more work. Hardware-wise, that was junk. At the time I had that, I also hadn't realized the sheer joy of a portable Unix.

I haven't tried Pinephone or Librem. I do have another product from Pine64 and the Venn diagram of rugged and Pine64 appears to be two non-overlapping circles. To them low price trumps rugged everyday. I can see where their coming from, but it is not going in my pocket — it will be destroyed.

Librem is more interesting. They clearly don't care about weight or price, so there's a chance it's got some ruggedness. The price is still too dear for me to buy as a play-with-whim, but I'm interested.

So what did I get? I got a Cat. Specifically an S60, with the built-in FLIR thermal camera. And then about two years later replaced it with an S61, which has built-in FLIR thermal camera, a volatile organtic chemical (VOC) sensor, and a laser tape measure. I don't use the tape measure much, but I do track air quality with it. My big complaint is VOCs are only part of air quality: there's particulate matter (notably from wildfire smoke) and ozone, which I find fairly unpleasant. But I've often wondered about how high the ozone has to be before I notice.

And on those Cat Phones, I've installed Termux. I love being able to compile and run new software on my phone, even if I don't actually develop much on the device. I've mostly written shell and Perl scripts on the go, but I did get trn4 working, which involved some C hacking. One of the trickiest parts of getting the heir of Larry Wall's rn news reader running was the very deep assumption Wall made in thinking /bin/sh will always exist, even if the features it has may very. Termux has sh, but it's in a different directory... There were a few other issues like passwd files not existing, but they were easy fixes in the C. That code is very rugged against missing things on the system and is, eg, fully prepared to deal with getpwent() doing something useless. I just had to make it not call getpwent() at all.

But yeah, a rugged always connected Unix (and Linux is fine, but not the only thing I'd accept) device, probably with an okay camera, that maybe could also take calls that fits in my pocket. That's what I want. A rugged device that makes phone calls and not much else, no, cool as it is, no.

Tim Hunkin: engineer * cartoonist


Lots of good stuff here. Specialty arcade machines, like a photo booth equipped to distract you while the photo is taken (eg by dropping the seat, or blowing cold air at you); notes and shots for 'The Secret Life of Machines' television program; homemade cameras; various large clocks, etc.

Link