Use Neovim Autocmd to Alter Colorscheme


I’m currently using the onedarkhc colorscheme for Neovim. I like nearly everything about it, except for the default comment color. Out of the box it uses a very faint grey that I find hard to read against a dark (black) background.

To change the color I’m using an autocmd to override the highlight color for comments.

local _general = agrp("_general", { clear = true })

acmd({ "ColorScheme" },
      { pattern = "*",
        callback = function()
          vim.api.nvim_set_hl(0, "Comment", { fg = "Grey63" })
        end,
        group = _general })

agrp and acmd are local functions that wrapper vim.api.nvim.create_group and vim.api.nvim.create_autocmd respectively.

Finding a color I liked actually took longer to accomplish than creating the autocmd.


Piano Compositions by Sibylle Kuder


My wife, Sibylle Kuder, has a growing collection of teaching pieces composed for piano available on her Compositions website. All of the pieces are available through SheetMusicPlus and SheetMusicDirect. Great gift idea for the developing pianist in your life.


Script to Create Hugo Post


When I was using Jekyll to build and deploy this site, I had a Rakefile setup that let me perform a number of common tasks. By typing rake <action>, where action was draft or publish or deploy, I could create a new post, publish a draft, or deploy the site to my web host.

I want to have the same kind of ease with Hugo. As a first step I have created a small Bash script that creates a new post and then opens it in my editor.

Here’s the script.

function hnew() {
    str="$*"
    # replace alphanumeric words with a dash, compress repeated dashes to a single
    # dash, replace capital letters with lower case
    post=$(echo $str | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z.md).md
    hugo new posts/$post
    nvim content/posts/$post
}
  • $* is everything that was typed after the function name, i.e., the title desired for the new posting.
  • sed 's/[^[:alnum:]]/-/g' converts alphanumeric words to a single dash
  • tr -s '-' compresses multiple dashes to a single dash
  • tr A-Z a-z.md replaces capital letters with lowercase letters

Once the post has been created, it is opened in Neovim, ready to be edited.


Site Updated


After using Jekyll for years to generate my website, I have switched to Hugo. There are a number of reason, which I’ll cover in a later posting. I believe most, if not all, of the features of my site have been successfully converted. (As of 10/30/2022 my image on the “About” page isn’t working.) Poke the email icon in the sidebar to let me know if you find something that isn’t quite right.


Nordschleife Lap Record Porsche 919



Goede Hoop Marimba Plays Vivaldi



Check if Reboot is Required on Linux


Here are some ways to determine if your Linux system requires a reboot following an updated.

RedHat OS Family

Applies to RedHat, CentOS, and Amazon-Linux.

Install the yum-utils package, which contains the command needs-restarting. This command can be used to check if a full reboot is required because of kernel or core library updates (using the -r option) or what services need restarting (using the -s option). The command returns a 0 if a reboot is not required, or a 1 if it is, so it can be scripted.

$ sudo needs-restarting -r
Updating Subscription Management repositories.
Core libraries or services have been updated since boot-up:
  * kernel
  * systemd

Reboot is required to fully utilize these updates.
More information: https://access.redhat.com/solutions/27943

Debian OS Family

Applies to Debian and Ubuntu.

If the file /var/run/reboot-required exists then the system needs a reboot. This script example shows how this can be checked.

#!/bin/bash
if [ -f /var/run/reboot-required  ]; then
  echo 'reboot required'
fi

A list of packages with pending changes that require a restart are listed in /var/run/reboot-required.pks

$ sudo cat /var/run/reboot-required.pkgs
libssl1.0.0

There is a helper tool for Debian/Ubuntu called needsrestart that can be installed.

sudo apt install needsrestart

Running this program with not options specified, will attempt to restart all services that have been updated. It can also be run interactively to see which services require restarts.

sudo needsrestart -r i


Zero to Production in Rust Day Zero


I’ve spent the past two years learning Go language and using it for some of my personal projects. I’m in the midst of converting this website from using Jekyll to using Hugo, and wrote a conversion program to port all my postings from the old site to the new in Go. For the last year or so I have become increasingly aware of the Rust programming language, and I have wanted to learn more about it.

I’ve just purchased Zero to Production in Rust by Luca Palmieri. My goal is to spend some time everyday reading the book, and working through the code. I plan on capturing my thoughts, successes, setbacks, etc., in daily (near daily) blog postings.

For added interest, I’ve decided to see if I can recreate the same application in Go along side the one the book creates in Rust.


Use Browser Profiles for Multiple AWS Accounts


AWS allows the use of multiple accounts to help separate billing, business units, functional items, etc. One downside to multiple accounts is needed to sign into and out of accounts to access the AWS resources or functions you need.

My employer has multiple accounts that I use on a daily basis:

  • Dev
  • Sandbox
  • Prod
  • Shared

Until today I made use of multiple browsers and incognito windows to be able to be signed into multiple accounts at one time. A lunch time conversation with a former collegue clued me into browser profiles.

A browser profile is a complete encapsulation of all the settings, bookmarks, browsing history, etc., for an identity. Using different profiles, one for each AWS account, it is possible to be signed into several AWS accounts simultaneously, without resorting to private windows or using several different browsers.

It appears that Firefox, Chrome, and Brave all support profiles. Brave is based on Chrome, so I suspect any browser using Chromium will also support profiles.

Brave, at least, adds a “Profiles” menu, that lists all the profiles allowing quick access to any of the others. Even better, by adjusting the theme / color scheme for each profile you can visually separate them. Green for dev, yellow for test, and red for production.

Browser profiles makes multiple AWS accounts much less work.


Why Bash Strict is Not a Good Idea


Like many, I found, read, and followed the articles about “bash strict mode” believing it would make my scripts better. In some cases my scripts worked fine. In others I had strange results, that were only addressed by removing set -e. This article explains why “strict” mode is probably not a good idea.