Nice FreeBSD bash prompt

Thoughts

Every now and then I get the following upon logging into a FreeBSD box:

Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ 

Seems like an odd choice for a tip, given bash is GNU and doesn’t come with the base system. I guess the maintainers figure sufficient numbers of sysadmins install bash from ports.

I try as much as possible to still use tcsh for my interactive shell, and standard sh for scripts.


$q q Vim bug, and moving to vim-console

Software

I had this weird Vim bug on a couple of FreeBSD box I maintain. The last line would always be partially clobbered with these characters when opening a file, or would be added to a new buffer:

$q q

I briefly thought it was writing and duping :q to the file, instead of interpreting it, but hitting ZZ like a certain musical fan did the same thing. Pro tip: They’re pronounced Zed-Zed Top. It clearly wasn’t the case though; it had no ill effects on config files, and cat didn’t show them. So it looked like a rendering issue.

Not to get all 43 Folders on you, but turns out it was specific issue with using Terminal.app on macOS to access specific versions of Vim. This bug on GitHub suggests its Terminal.app’s fault for advertising itself as xterm in $TERM; a common practice among terminal emulators, but not strictly true. If so, it’s curious it didn’t manifest before.

In any case, there’s a mitigation in place in the most recent versions. So upgrade and be done!

The second curiosity came from trying to upgrade vim. I used vim-lite on headless servers, so I don’t pull in Xorg or GTK dependencies. But when I went to upgrade it:

# pkg upgrade vim-lite
==> pkg: No packages available to upgrade matching
==> 'vim-lite' have been found in the repositories

Weird! Checking all available vim ports:

# pkg search vim
==> [..]
==> vim-8.0.1769
==> vim-console-8.0.1769
==> vim-tiny-8.0.1769
==> [..]

Checking vim-console in Freshports, the tireless maintainer adamw@ committed this change on the 11th of January:

Rename editors/vim-lite to editors/vim-console. The vim-console port isn’t the main vim port. The only difference is lack of gtk20 GUI, and the language bindings are off by default.

Makes sense. So now we can upgrade:

# pkg remove vim-lite
# pkg install vim-console

And now I’ve banished $q q! I shouldn’t be this happy about this.


FreeBSD doesn't need moused for Xorg

Software

I often see third-party FreeBSD desktop guides that include this:

# pkg install xorg xfce4 slim
% echo "exec xfce4-session >> ~/.xinitrc"

Xfce remains my pragmatic favourite after all these years. But WindowMaker is also wonderful and nostalgic, and tiled window managers are for squares:

# pkg install windowmaker

The guides then advise you to configure these /etc/rc.conf services:

moused_enable="YES"
dbus_enable="YES"
hald_enable="YES"
slim_enable="YES"

This is all fine, but moused isn’t necessary. From the manpage:

The moused utility and the console driver work together to support mouse operation in the text console and user programs.

Your mouse is almost certainly using the xf86-input-mouse driver automatically, unless you don’t install the Xorg metapackage.


Friday Fanmail: $1009

Internet

It’s time for some more Friday fanmail! Though I accidently forgot to post this last Friday, so it’ll be Wednesday. That means it’s either two days early, or very late.

HELLO,

YOU MIGHT HAVE SEEN THIS CNN SPECIAL YESTERDAY- IT’S TRUE, THIS BITCOIN PROGRAM CAN MAKE YOU OVER $1009 IN JUST ONE WEEK.

CLICK ON THE LINK BELOW TO GO TO CNN AND DOWNLOAD YOUR FREE TRIAL.

THAT SOUNDS AMAZING AND I WISH TO SUBSCRIBE TO YOUR NEWSLETTER!

Wait, only $1009? Get back to me when you have a trillion billion.


It's a foggy Sydney this morning

Thoughts

Photo of fog in Sydney from North Sydney this morning

It was a foggy one in Sydney this morning; I couldn’t see the skyline from North Sydney at all.

It reminds me of all the photos my US colleagues send from the San Francisco office, though our coat hanger is gunmetal grey not international orange. I can see where being the latter would be useful in these circumstances!

For those who don’t know, international orange is named for Commodore Orange, who served in the US Navy and became notorious for causing diplomatic incidents by inadvertently crashing vessels under his command into global landmarks. Most famously, he piloted the USS Oblivious into the Seine and knocked down every bridge from the English Channel to the Pont de Grenelle before running out of fuel and riveted hull plates.

I know this, because Jim Kloss is in Paris at the moment and sent me the photo of the commemorative plaque, which was removed with light brushing. At least two paragraphs of this post were bullshit.


IPv6 address easter eggs

Internet

I just noticed one of the Ubuntu mirrors has the following IPv6 address:

2001:388:30bc:cafe::beef

Domain hacks are so passé, especially when you have a hex character set to play with!


Lists and outlines

Internet

I gravitate towards websites that let me make lists and outlines. Yesterday I learned of Kit.com, which sounds like it’d be about a snappable chocolate snack. Instead, it lets you make lists of stuff you use.

I was about to launch into making some, beyond this half-baked everyday carry list, like a bullet point junkie in search of his next fix. But why not publish them here? My silly little blog will likely outlive it, like so many other sites I relied upon in the past.

I’m not sure how I’ll present these lists. I could be lazy and just make blog posts with text-based lists, or they could be on separate Hugo pages with tiled thumbnails. Heck, it’d might be an excuse to finally learn CSS Flex, the thing that’s supposed to make CSS as easy to use for cell-based layouts as tables were twenty years ago.

I should make a list of the options.


Feedback on static comments

Internet

Last Thursday I put out an RFC on comment systems, and how I’d include them again on this statically-generated blog. I got some great feedback!

Here’s the thing: don’t do it

I sensed a theme in many of the comments. I’ll let Daniel W. summarise much of the sentiment:

For the love of god, DON’T DO BLOG COMMENTS!

His argument was that the world has become even less civil and more spammy since I turned off blog comments here years ago, and that I’m not missing much.

At the time I argued spam had got too much, but I also disabled comments for all the unhelpful people who couldn’t see the forest for the trees. It was frustrating getting mired down in pointless minutea when the broader point of a post was being ignored.

Specifically about anime, Daniel continued:

Blogging about anime in 2018, that’s a paddlin’. People shitpost you for everything and think they are clever. It’s so tiring. Fuck that.

Anime/otaku/weeb stuff was always a side show here, so I never had the noteriety or internet fame to attract those sort of comments. But who knows now?

Your comments have been heeded! Thank you for putting some perspective on this.

The third way

But what if I want to go in full tilt and enable comments here? My concern was I had two choices: go back to a dynamic CMS, or include a JavaScript client like Disqus. I didn’t like either.

Turns out, there’s a third way I hadn’t considered: accept comments with a web form, backed by a script that appends them to the right post, and regenerates the site. Huge thanks to Jim Kloss from Whole Wheat Radio, and William Hales from Halestrom for cluing me into this now obvious idea, and for taking the time to dive into it.

I love it for a few reasons:

  • It keeps the site static, which means fast and easy.

  • I can write the scripts I need in Perl, still my first love after all these years and many other languages later. Or even shell scripts, as William suggests.

  • I can use a FreeBSD jail and rate-limit on IPs to keep spam down, or even queue posts for me to release manually every few days.

From Jim’s email:

If comments are just data appended to the original static data, the issue is how to append data as though you had included it in the original data. You receive additional data (comments) and type at the bottom of the original data. So the question (I assume) is how/where to collect the data and then automate the typing. Could you have a “drop box” where data could be deposited on your site then a cron-like task that tacks it onto posts? How would the new data be identified so it gets tacked onto the correct post? How could the depositing of this additional data be made a fun and safe process for the writer? Could you just collect comments from Twitter, email, drop box, phone messages, audio, etc. and append them? Something even more creative … a global blob where ALL comments are gathered, unassociated with their original, except for however the reader/commenter wants to join them in their own mind? FUN!

Merci! He’s in France right now :). It would require me to generate the site on the server, rather than locally and push with rsync. But that’s a long overdue change anyway, so I could see this working.

For those who didn’t know Whole Wheat Radio, Jim knows all to well the idea of a drop box system; WWR had this awesome feature where you could call in phonegrams that would be queued and played live on the air.

William’s blog post was similarly amazing, with screenshots and stores of hidden bodies. He implemented a static site comment system on Haelstrom, and even thought through the issues with spam and abuse. The whole thing is worth a read, but these were my favourite lines:

Ruben Schade is asking for advice about adding a comment system to his blog? You fool! I’m only too willing to give it.

Suggested solution: write a small .cgi script that handles accepting comments and generating .html files containing nothing but them. Then [iframe] or similar them in to your main pages, so you don’t have to modify your main pages (or touch your vcs) when a comment gets added.

Until then: don’t throw databases at problems your filesystem will happily solve.

Using this as an exercise

I realised while writing this post that soliciting comments and getting email had been a fun exercise itself. Maybe I’m overthinking this, and I should just keep it there.

The main downside there is people may not be enthusiastic about commenting if they either need their own blog to link back to mine, or to write me an email. But as Jim says:

I read you daily and have frequent knee-jerk reactions to comment – and therefore sorta appreciate not being able to comment because by now I’d have made a fool of my myself

I don’t think there was ever a risk of that :).


New frontmatter generator

Internet

Please disregard, testing if my new Hugo frontmatter generator works :).


The Eurasian Blue Tit, by Francis Franklin

Media

Photo of the Eurasian Blue Tit, by Francis Franklin

A bird was a Wikipedia picture of the day again, so I had no choice but to include it here.

The Eurasian blue tit (Cyanistes caeruleus) is a small passerine bird in the tit family, Paridae. It is easily recognisable by its blue and yellow plumage and small size.