RSSAmplifier

Blog

Staring at the C

Recent content on Staring at the C

movementarian.orgRSS feed ↗187 posts

Latest posts

vfio-user client in QEMU 10.1

The recent release of QEMU 10.1 now comes with its very own vfio-user client. You can try this out yourself relatively easily - please give it a go! 1 vfio-user is a framework that allows implementing PCI devices in userspace. Clients (such as QEMU) talk the vfio-user protocol over a UNIX socket to a device server; it looks something like this: To implement a virtual device for a guest VM, there…

It's Always DNS

The meme is real, but I think this particular case is sort of interesting, because it turned out, ultimately, to not be due to DNS configuration , but an honest-to-goodness bug in glibc . As previously mentioned , I heavily rely on email-oauth2-proxy for my work email. Every now and then, I’d see a failure like this: Email OAuth 2.0 Proxy: Caught network error in IMAP server at [::]:1993…

Scroll wheel behaviour in vim with gnome-terminal

I intentionally have mouse support disabled in vim , as I find not being able to select text the same way as in any other terminal screen unergonomic. However, this has an annoying problem as a libvte / gnome-terminal user: the terminal, on switching to an “alternate screen” application like vim that has mouse support disabled, “helpfully” maps scroll wheel events to arrow…

A Headless Office 365 Proxy

As I mentioned in my last post , I’ve been experimenting with replacing davmail with Simon Robinson’s super-cool email-oauth2-proxy , and hooking fetchmail and mutt up to it. As before, here’s a specific rundown of how I configured O365 access using this. Configuration We need some small tweaks to the shipped configuration file. It’s used for both permanent configuration…

Fetchmail and Office 365

I previously described accessing Office365 email (and in particular its oauth2 flow) via davmail , allowing me to continue using fetchmail , procmail and mutt . As davmail is java, it’s a pain to have around, so I thought I’d give some details on how to do this more directly in fetchmail , as all the available docs I found were a little vague, and it’s quite easy to screw up. As…

Relative __FILE__ With CMake

I have the misfortune of maintaining some things using CMake. One major annoyance is that __FILE__ is an absolute path, and that can’t be changed in CMake itself. Like most CMake annoyances, you can find a discussion online from about 15 years ago, but no sign of an actual fix. Instead, you need a hack: this - I think - is the simplest one. First, in our top-level CMakeLists.txt ,…

How I Code Review

I thought it might be interesting, at least to myself, to write up how I approach code reviews. My history in tech is one where close code review was emphasized and well-respected: most appreciated that a detailed review was not only worth the reviewer’s time, but mutually beneficial, and often a great learning experience for everyone. So my tiny mind can’t process ideas like…

Testing a C Library With Python

It’s still common for a systems library to be written in the default lingua franca, C, although Rust is encroaching, for good reasons. However, when it comes to testing, things get tedious quickly: writing unit or component tests in C is a slow, bug-prone exercise. With libvfio-user , after fixing too many bugs that were due to the test rather than the test subject, I decided it would be…

Github Pull Requests

Stefan Hajnoczi recently posted about clean commit history . It’s a controversial viewpoint that not everyone agrees with - there is a sizable population in favour of “never rewrite history”. For me, though, the points he makes there are totally correct: each commit should be a logical change, main (neé master ) should stay green, and CI should pass at every single point in main…

Mutt and Office365

For reasons, I now need to interact with Office365 mail and calendar. It should go without saying that the Outlook webapp is almost painfully unusable (there really is no key binding for “next unread email”). Thus began the quest to get mutt interacting with the O365 server. This was a rather painful process: so much of the information on the web refers to earlier authentication…

procmail and threads

I’m apparently old-school enough to find gmail and co painfully inefficient for handling significant amounts of mail. I still find procmail + mutt hard to beat. One thing mutt can’t do, however, is filter threads automatically - there’s no “mute” facility like gmail has; threads have to processed manually. Equally, procmail itself has no threading facilities or…

Arrow Keys in Firefox

I&rsquo;m not the only one disappointed in the way the web has worked out in lots of ways. From <blink> onwards, so much semantic information is missing from the average website, sometimes wilfully it appears. Why is there so little structural data on what the components of a page are? One particular peccadillo I dislike is &ldquo;Previous/Next Page&rdquo; elements on a list page. Nobody ever uses…

Docker, Go and USDT

We have what should be a simple task: we&rsquo;re on CentOS 7, and we want to deploy a Go binary that will have USDT tracepoints . USDT is an attractive option for a few debugging purposes. It allows applications to define tracepoints with higher levels of stability and semantic meaning than more ad-hoc methods like dynamic uprobes. Usage of USDT tracepoints tends to have a different focus from…

ctags, vim and C

Going to the first matching tag in vim with Control-] can be rather annoying. The exuberant-ctags secondary sort key is the filename, not the tag kind. If you have a struct type that&rsquo;s also a common member name, you&rsquo;re forced into using :tselect to find the struct instead of all the members. Most of the time, the struct definition is what you want. To avoid this issue, I sort the tags…

A Simple Pibell

With all this free time I finally got around to installing a doorbell at home. I had no interest in Ring or the like: what I really wanted was a simple push doorbell that fit the (Victorian) house but would also somehow notify me if I was downstairs&hellip; There are several documented projects on splicing in a Raspberry Pi into existing powered doorbell systems, but that wasn&rsquo;t what I…

URLs in gnome-terminal and mutt

For some time now, gnome-terminal amongst others has had a heuristic that guesses at URLs, and allows you to control-click to directly open it. However, this was easily foxed by applications doing line-wrapping instead of letting the terminal do so. A few years ago, gnome-terminal gained ANSI escape sequences for URL highlighting . It requires applications to output the necessary escape codes, but…

Migrated Blog

With my Coronavirus-related CFT I finally got around to migrating off Blogger. I lost comments, but I think I&rsquo;ll probably keep it like that: there&rsquo;s twitter, and Blogger&rsquo;s anti-spam facilities were pretty much hopeless. My first attempt used jekyll . I suppose this works best with Github Pages, because I gave up on it pretty quickly: various irritating Ruby version…

github commits via email

I&rsquo;m the old-fashioned type who still likes getting email: I can process it at my leisure while still handling high volume. Unfortunately github itself can&rsquo;t email you when commits are made to a particular repo (unless you own it and can configure hooks). So I need to resort to the atom feeds, and rss2email : $ r2e new jlevon@movementarian.org $ vi .rss2email/config.py # set local…

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&rsquo;s proven very useful for me.

Open all links in Gerrit

Newer versions of Gerrit, somewhat insanely, lack the old &ldquo;Open All&rdquo; button to open each file in its own tab. Here&rsquo;s a bookmarklet that does so: javascript : ( function () { var dl = document .querySelectorAll( '.pathLink' ); if ( ! dl.length) { dl = document .querySelectorAll( 'a.gr-file-list' ); } if ( ! dl.length) { dl = document .querySelectorAll( '.path' ); } if ( !…

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…

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&rsquo;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&rsquo;t just directly modify the files. As originally…

My awesome download manager

Since Liferea in more recent versions requires a download manager (it does not attempt to deal with the constant &ldquo;new&rdquo; podcast downloads on broken RSS feeds), I tried a few 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…

wodim under Ubuntu

wodim/k3b are unusable on Ubuntu: after making sure you&rsquo;re in the cdrom group, you need to add to /etc/security/limits.conf : @cdrom - memlock unlimited (Or some limit, I suppose, if you&rsquo;re bothered.)

PCI pass-through support with bhyve and SmartOS

Some prompting on IRC led me to do this write-up on how to configure PCI passthrough for a bhyve instance running on SmartOS. Please be aware this isn&rsquo;t necessarily fully supported or tested; it may work for you, it also may not. Some of this is covered under RFD 114 ; the below is more of a HOWTO. Global zone configuration To allow a bhyve zone to access a PCI device, we need to prevent the…

PCID support on Illumos

I joined Joyent at the start of the year while Meltdown was breaking news; it was certainly an &ldquo;interesting&rdquo; time to start a new job. Luckily by my first week, Alex and Robert had pretty much figured out how the changes should look and made good inroads on the implementation. So I began working with Alex on his KPTI trampoline code (mainly involving breaking it with my old friend…

Converting HTML mail via procmail

All the procmail recipes I found on a quick search failed to handle quoted-printable HTML encodings, regularly used everywhere. And those that had quoted-printable examples used tools no longer maintained - such as mimencode. The solution is to use Perl directly: :0 * ^Content-Type: text/html; { :0c html/ :0fwb * ^Content-Transfer-Encoding: *quoted-printable | perl -pe 'use MIME::QuotedPrint;…

Ripping vinyl on Linux

I&rsquo;ve been ripping a lot of stuff from vinyl to FLAC recently. Here&rsquo;s how I do it. I have an Alesis I/O 2, which works well and seems fairly decent quality. First, most important, step, is to stop trying to use Audacity. It&rsquo;s incredibly broken and unreliable. Go get ocenaudio instead. It&rsquo;s fairly new, but it works reliably. After monitoring your levels, record the whole…

Recording on Linux with Alesis io|2

A little note for myself: to get low-latency monitoring, and more importantly, record at the right rate, you need to set the Configuration-Profile to &ldquo;Digital Stereo Input&rdquo; in pavucontrol ! Update: you also need this in ~/.pulse/daemon.conf : default-sample-rate=48000 Another update: PA/ALSA often seems to forget the sensible default devices, and ocenaudio starts trying to record from…

Old web content

I think it's important that everyone should endeavour to maintain existing web content, even if it's not currently relevant.

PayPal idiocy

This is unbelievably stupid of Paypal. I just got this email from them: vinyl tap records would like you to use PayPal - the safer, easier way to pay and get paid online. To send vinyl tap records your payment and see the details of this invoice, copy and paste this link into your web browser: https://www.paypal.com/uk/cmd=_prq&id=... So much for &ldquo;never click a URL in email&rdquo;. Even…

NatWest phishing service

I got some NatWest phishing spam the other day and was amused to notice this: <title>NatWest - Security Information</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="http://www.natwest.com/microsites/global/phishing_demo/includes/css/generic.css" media="all" /> ... <a href="http://www.natwest.com/"><img…

Name and shame time

To quote 123-reg customer support: > When will you be supporting AAAA records? There are no current plans to implement this but notifications will be sent out if this takes place.

Avoid vps247 hosting

Late last year, I was forced to find a new host for movementarian.org , as my previous hosting provider (Blue Room Hosting, who were really great) were shutting down. I went with VPS247 , as they were local to Manchester and seemed reasonable. Unfortunately my experience has been terrible. They&rsquo;ve failed to keep the machines on the net, regularly causing ssh sessions to die. The dmesg is…

pbranch curiosities

I&rsquo;ve started using pbranch extension for hg more seriously. It works nicely but is a little rough around the edges, in particular: No hg qpop/push equivalent I really miss this. I find myself constantly doing hg pgraph to figure out where I am and then typing the patch above or below. No way to shelve a patch With MQ, I can easily guard a patch to temporarily remove it from the queue. There…

Re-enable Ctrl-Alt-Backspace in Xorg

Create the following as /etc/hal/fdi/policy/30user/10-x11-zap.fdi : <?xml version=&ldquo;1.0&rdquo; encoding=&ldquo;UTF-8&rdquo;?> <deviceinfo version=&ldquo;0.2&rdquo;> <device> <!&ndash; Default X.org input configuration is defined in: /etc/hal/fdi/policy/30user/10-x11-input.fdi Settings here modify or override the default configuration. See comment in the file above for more information. To see…

Disabling that goddamn GTK bell

echo &lsquo;gtk-error-bell = 0&rsquo; &raquo;$HOME/.gtkrc-2.0

Changing liferea keyboard shortcuts

Liferea has no keyboard shortcut editor itself, but &ldquo;Toggle unread status&rdquo; demands the wrist-breaking chord action of Control-U. It expects you to be able to edit the shortcuts via the editable menu feature of GTK+. Unfortunately that&rsquo;s disabled on all modern GNOME installs, and there&rsquo;s no UI for re-enabling it. As usual, gconf-editor to the rescue. The key you need to…

Epson all-in-ones: avoid like the plague

Browsing the net, you might get the impression that Epson Stylus All-in-ones are well supported under Linux. Unfortunately this is not the case. The pipslite driver you have to install is extremely flaky, and Fedora SELinux doesn&rsquo;t work properly with it. There&rsquo;s no &ldquo;draft&rdquo; mode for some bizarre reason; printing is extremely slow and often randomly cancels half-printed jobs…

Setting up JACK on Fedora 12

Audacity is somewhat of a broken joke these days, so I needed to use Ardour to record. And that meant setting up JACK. Since JACK insists on exclusivity, I also needed to route pulseaudio through JACK so I could use other apps at the same time. Unfortunately, this is a bit of a pig to figure out. I hacked it as follows: First edit /etc/pulse/default.pa , you need to add two lines: load-module…

Liferea strict feed validation tip

New versions of Liferea refuse to parse any feed that fails to validate, even for relatively &ldquo;minor&rdquo; problems (the libxml2 recovery facility is no longer used; besides, it abandons the rest of the feed when it hits such problems). I don&rsquo;t want to use Google Reader, since I don&rsquo;t like the interface. Typically bad feeds have things like high-bit chars or bare ampersands.…

esr

“The main indicators of egotism as I intend it here are are loud self-display, insecurity, constant approval-seeking, overinflating one’s accomplishments, touchiness about slights, and territorial twitchiness about one’s expertise. My claim is that egotism is a disease of the incapable, and vanishes or nearly vanishes among the super-capable.” “I’m the crippled kid who became a black-belt martial…

Enabling xVM on OpenSolaris

Another significant usability improvement that landed in build 126 is Gary and Bill's work on enabling Xen. Now, running xVM should be as simple as: # pkg install xvm-gui # echo 'set zfs:zfs_arc_max = 0x10000000' >>/etc/system # yes, you still need this, sadly # svcadm enable -r milestone/xvm # reboot There's also a new Visual Panel for doing this if you prefer a graphical method. More in the flag…

Dry-run migration

As part of our ongoing work on improving the ease of use of xVM, the newly available build 126 of OpenSolaris has my putback for: 6878952 Would like dry-run migration This feature is useful for doing a simple check as to whether a guest can successfully migrate to another dom0 host. For example, domu-221 here is using a disk path that doesn't exist on the remote host hiss : # virsh migrate…

A horrible little ElementTree gotcha

What does this print: from lxml import etree doc = etree.fromstring('<a><b><c/></b></a>') newdoc = etree.ElementTree(doc.find('b')) print newdoc.xpath('/b/c')[0].xpath('/a') The answer is: [<Element a at 817548c>] . The first point to note is that xpath() against an element is only relative to that element: any absolute XPaths enumerate from the top of the containing tree. The second point is that…

YouTube annoyance

How much time would it really take to order multi-part videos, so the suggestion at the end of the video is the next part? Please!

xVM and COMSTAR iSCSI

I recently had cause to try out COMSTAR for the first time, and I thought I'd write up the steps needed. Unfortunately, it's considerably more complex than the fall-over-easy shareiscsi=on ZFS feature. Configuring the COMSTAR server First install the storage-server packages and enable the services: # svcadm enable -r stmf # svcadm enable -r iscsi/target We want to create a target group for each of…

An annoying Python gotcha

Imagine you have this in mod.py: import foo class bar(object): ... def __del__(self): foo.cleanup(self.myhandle) Seems fine right? In fact, there&rsquo;s a nasty bug here. If I try to use this module in client.py like so: import mod mybar = bar() Then you&rsquo;re likely to get an exception when the program exits. This is because Python, for some bizarre reason, Nones out the globals in mod.py…

Kernel solipsism

Thomas Gleixner : Exactly that&rsquo;s the point. Adding dom0 makes life easier for a group of users who decided to use Xen some time ago, but what Ingo wants is technical improvement of the kernel&hellip; The kernel policy always was and still is to accept only those features which have a technical benefit to the code base. It boggles the mind that someone could get things so backwards. The…

OpenSolaris 2009.06 guest domain on a Linux dom0

Just a quick note: you can follow the instructions I provided for the 2008.11 release, with one change. On a 64-bit machine, replace any instances of /boot/x86.microroot with /boot/amd64/x86.microroot . As of 2009.06, the boot archive is split into 32-bit and 64-bit variants. If you get a message like this: krtld: failed to open '/platform/i86xpv/kernel/amd64/unix' Then you've probably given the…