:: home : bio : blog
A storm in the distance, hopefully receding.
September
Sun Mon Tue Wed Thu Fri Sat
         

Contact


 

Archives

Recent Posts

Wed, 27 Sep 2023
Water Works
# 18:10 in ./general

Every year, the Mall Galleries in London hosts an exhibition of the Royal Society of Marine Artists and the 2023 show finishes on September 30th. Unfortunately, I don't get down to see them anymore, but the gallery always puts them online and it's the next best thing. As always, amazing works of art.

Some awards are given out each year (online). Frankly, they're all excellent but here are two I particularly like. Jenny Aitken's Sundown from Harwich Quay (link) because of the beautiful evening light, and Raymond Leech's Evening Crabbing Session Blakeney (link) because of it's lovely "painterly" execution. Great light as well!

Above: Sundown from Harwich Quay, Jenny Aitken, Oil on canvas, 40x50 cm

Above: Evening Crabbing Session Blakeney, Raymond Leech, Oil on canvas, 18x23 cm

The world is a lot better with good art.


Sun, 24 Sep 2023
WILL: Getting the File Name from a Whole Path
# 20:36 in ./tech

There is a more straightforward way to do this, plus a more arcane way (syntax-wise). There's a lot of arcane in the Bash Shell and in some ways, it's like Vim: you just have to get used to things, try and remember them and not ask "why?" too much.

If you have a file path and want to know the last part (usually the file name) only, you can use the command basename (man basename) e.g. If I have a path : /usr/include/stdio.h, then :

basename /usr/include/stdio.h

Gives me : stdio.h.

The command also has options to strip a suffix (e.g. the ".h" part).

Alternatively, a more arcane was is to use the parameter expansion functionality of the Bash shell.

FILENAME="/usr/include/stdio.h"
echo "${FILENAME##*/}"

This is looking for a pattern ("##") and stripping everything up to the last "/" (*/).

This also gives : stdio.h

Did I mention arcane? There are are lot of very useful features like this in the Bash shell but they can just be a little hard to remember sometimes (and you have to watch out for "gotchas" using them!).

Reference:

See Bash Manual : Parameter Expansion


Sat, 09 Sep 2023
WILL: Substituting Within Vim Visual Selection Only
# 16:00 in ./tech

In vim you can be in a visual selection mode, perhaps selecting only parts of the text file. Normally, a substitution operation (e.g. replace string "2022" with "2023") operates on a whole line (or range of lines). To restrict this to operate only on the visual selection you have, use the "\%V" pattern at the start of your search.

So, assuming a visual selection is highlighted and within this I want to change "-" to " " :

:'<,'>s/\%V\-/ /g

A highlight containing "This-is-a-test" becomes "This is a test".

See Vim help %V

Reference :


Wed, 06 Sep 2023
WILL: Naming My Ethernet Device
# 15:24 in ./tech

My server has USB 2.0 only and I thought I'd upgrade it to USB 3.0 via a Startech USB 3.0 PCI card. Installation was straightforward but after restarting the computer I discovered my networking was broken.

It turns out that my ethernet device used to be enp2s0 but was now enp3s0 and my network setup failed.

This type of kernel device name is created based on various schemes e.g. the physical location of the connector of the hardware on the PCI bus. See the Redhat Docs.

I've been using Linux for many years now and computers have changed a lot in this time. Leaving aside the huge advances in CPU, RAM and storage, many computer devices are not "fixed" in place but can come and go (even CPU's and RAM). Mostly, these devices might get plugged in or out, such as a USB mouse or external USB hard drive. PCI devices are also capable of being "hotplugged" and when any of this happens, the kernel has to scan the new configuration and determine what devices are present. Sometimes it has to re-arrange the device names.

My server is an old HP Microserver (N36L) : 12 years old now but still going strong (although it needed a new power supply last year). Because I use an external USB disk for backup, USB 3.0 will speed things up a lot (I hope). On to the reboot and networking failure ...

To fix this, I could just change my ethernet device name in my network setup files (i.e. /etc/network/interfaces on Debian). I decided to use systemd and create my own persistent and simple (old-fashioned) name for the device.

Systemd Link

This is "link" as in a network link (man page : systemd.link).

Use :

ip l

to get the MAC address for the network device enp3s0. Then create the file :

/etc/systemd/network/10-eth0.link

The file must end with ".link" and preferably begin with numbers (as a run order). It contains :

[Match]
MACAddress=<YOUR MAC ADDRESS>

[Link]
Name=eth0

I edited my network setup scripts (Debian : /etc/network/interfaces) to use the network name "eth0". Now, when I boot the system, the name "eth0" is set on the network device with my main ethernet MAC address and will stay that way.

I must add that I like systemd and how it's changed the Linux boot and system control landscape.


Fri, 01 Sep 2023
The Bigger Seat
# 06:20 in ./art

In January last year, I posted a piece about a small study I had done of Arthur's Seat called The Seat by the Loch. I worried that the picture was a bit too saccharine. Maybe it was, but I decided I ignore any qualms and go all in on the "colour" : and so painted a larger version. This was done in July 2022 and I think it turned out okay. So, varnished, framed and hanging on a wall somewhere near me :


Above: View of St Anthony's Chapel and St Margaret's Loch, Oil on Linen, 60x80cm

This is a view of St Margaret's Loch and St Anthony's Chapel on Arthur's Seat, Edinburgh. I'd sometimes have lunch sitting up there with friends, and sharing the rocks opposite the chapel with some ravens chasing any crumbs falling their way. Better a raven than a gull.


© Alastair Sherringham 2023
Powered by Blosxom.
Still going after all these years.