Why sudo Loses Your PATH on Linux and How to Keep It

How to keep your PATH when using sudo on Linux

When you use the sudo command on Linux, the PATH you configured as a normal user is not applied and you can end up with “command not found”. This happens especially often when you try to run a command inside Linuxbrew (Homebrew) with sudo and the command cannot be found. This article explains how to carry your PATH environment variable over into sudo. Why PATH changes under sudo For security reasons, sudo resets environment variables by default. [Read More]
Categories: Shell  Tags: Linux 

Making Hugo Post List Summaries Plain Text with plainify

Removing HTML tags from article summaries in Hugo using plainify

The summary display in the article list on the top page was being shown with the HTML notation still left in it, which felt wrong, so I fixed it ↓

Stripping the HTML also looks better for SEO, so I made the following change

layouts/partials/post_preview.html

<article class="post-preview">
    <a href="{{ .Permalink }}">
        <h2 class="post-title">{{ .Title }}</h2>
        {{ if .Params.subtitle }}
        <h3 class="post-subtitle">
            {{ .Params.subtitle }}
        </h3>
        {{ end }}
        {{ if .Params.image }}
        <img src="{{ .Params.image }}" alt="{{ .Title }}" class="img-title" />
        {{ end }}
        {{ if .Params.video }}
        <video loop autoplay muted playsinline class="img-title">
            <source src="{{ .Params.video }}">
        </video>
        {{ end }}
    </a>

    <p class="post-meta">
        {{ partial "post_meta.html" . }}
    </p>
    <div class="post-entry">
        {{ if or (.Truncated) (.Params.summary) }}
        {{ .Summary | plainify }}
        <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a>
        {{ else }}
        {{ .Content }}
        {{ end }}
    </div>

    {{ if .Params.tags }}
    <div class="blog-tags">
        {{ range .Params.tags }}
       <a href="{{"tags" | absLangURL}}/{{ . | urlize }}/">{{ . }}</a>&nbsp;
        {{ end }} 
    </div>
    {{ end }}

</article>
Categories: Hugo  Tags: Markdown 

Moving to init.lua on Neovim 0.11 and the E5422 Config Conflict

Migrating from init.vim to init.lua in Neovim 0.11: Complete Guide

I migrated the NeoVim configuration I set up in Reviewing my Zsh and NeoVim configuration over to Lua. TL;DR Neovim 0.11.5 assumes Lua, so moving from init.vim + vim-plug toward init.lua + lazy.nvim gives you a big return. For completion, blink.cmp is a strong choice these days. The 0.11 trap: init.lua and init.vim cannot live side by side (E5422: Conflicting configs). A staged migration takes some ingenuity. While I was at it: NERDTree→oil.nvim, hand-written brackets→nvim-autopairs, IME→Lua autocmd, cursor shape→guicursor. Background In the Neovim 0.11 generation, the ecosystem of LSP, diagnostics and the surrounding plugins moves ahead on the premise of Lua. If you keep maintaining a Vimscript-centred setup, [Read More]
Categories: editor  Tags: neovim lua 

Four .zshrc Mistakes That Quietly Break Zsh, and How to Fix Them

What came out of reviewing my .zshrc: return $(...), LC_ALL, compinit order and heavy ls aliases

I had been happily using the zshrc I set up in Reviewing my Zsh and NeoVim configuration as a base, but I went over the configuration again with the help of generative AI (ChatGPT-5.2). What I improved Made the broken predicate functions correct (stopped using return $(…)) Left the locale alone (LC_ALL in particular is easy to get wrong) Made completion work from the very first shell (avoided the landmine of zinit lazy loading combined with the compinit order) Isolated the heavy listings into ll/la so that everyday ls does not get slow Background: with .zshrc, convenience and destruction are a hair apart When it comes to improving a zshrc, there are more landmines of the “writing it the wrong way quietly breaks things” kind than there is work on appearance or adding aliases. These were the four places I got stuck this time: [Read More]
Categories: Shell  Tags: zsh zshrc 

Stop Frequent AlmaLinux Reboots by Disabling the NMI Watchdog

Tracing unexpected reboots back to the kernel watchdog on AlmaLinux

To begin with, I decided to look at the logs from just before the previous boot, so that I could tell whether this was really a reboot coming from the OS or a problem around the hardware power supply. On AlmaLinux (RHEL based), running journalctl -b -1 shows the logs of the one previous boot all together, so I used that command as a starting point and went over the kernel messages and the systemd logs. [Read More]
Categories: Linux  Tags: Almalinux RHEL 

Migrating a Documentation Site from Nextra 2 to Nextra 4

Migration Guide from Nextra 2 to Nextra 4

Introduction Nextra 4 was released and I tried to move a site built with Nextra 2 over to Nextra 4, but there were so many changes that the upgrade did not go well. So instead of updating the Nextra 2 project, I created a Nextra 4 project and decided to migrate the Nextra 2 project into the Nextra 4 project. In this article I go through the changes required when migrating from Nextra 2 to Nextra 4. [Read More]
Categories: Nextra  Tags: Nextra 

Why Hugo Shows the Wrong Last Modified Date on Cloudflare Pages

Fixing GitInfo issues on Cloudflare Pages

On a blog site built with Hugo, I was stuck for a while on a problem where the “Last modified” date of each post was not displayed correctly. Every post ended up with the same date, and the actual update date of each post was not reflected. In this article I explain the cause of the problem and how to solve it. My environment uses Github and Cloudflare Pages. Symptoms The “Last modified” date shown in the post metadata was the same date on every post. For example, it was displayed like this: [Read More]
Categories: hugo  Tags: hugo cloudflare 

How to Reload .bashrc and .zshrc Without Logging Out

A Complete Guide to Reloading Shell Configuration Files in Linux

After editing a shell configuration file (.bashrc, .zshrc and so on) on Linux or macOS, how should you apply the changes? Many people probably think of logging out once and logging back in, but in fact there are quite a few more efficient ways. This article explains the various commands for reloading a shell configuration, what characterises each of them, and how to choose between them. 1. The source command - the most basic method The source command is the most common way to run a shell script or a configuration file in the current shell environment. With this command you can load the contents of the specified file into the current shell session without starting a new shell. [Read More]
Categories: linux  Tags: shell 

Updating Hugo and My Beautifulhugo Theme After a Year Away

Theme update and site improvements

Somehow this is my first post in a long time, and before I knew it more than a year had passed without an update. (^_^;) Lately I have been doing vibe coding with generative AI, so I had no time to write articles. As for the Hugo behind this blog, if I do not keep it updated then changes in its features start causing problems, so I updated it. While I was updating Hugo, I also changed the look of the Beautifulhugo theme. For the changes as well, making use of generative AI these days keeps the coding moving along easily. [Read More]
Categories: hugo  Tags: theme 

Migrating the Beautifulhugo Theme from a Git Submodule to Hugo Modules

Learn how to transition your Beautifulhugo theme from submodules to Hugo Modules.

Up to now I had been using Hugo’s Beautifulhugo theme on this site as a submodule, but I switched it over to the hugo modules format. Environment I work by cloning my own repository from Github. First, a look at the local environment Copy ❯ go version go version go1.22.6 darwin/arm64 ❯ hugo version hugo v0.131.0+extended darwin/arm64 BuildDate=2024-08-02T09:03:48Z VendorInfo=brew The theme is beautifulhugo, installed as a submodule Initialising hugo modules Copy $ hugo mod init github.com/user/scribble go: creating new go.mod: module github.com/user/scribble go: to add module requirements and sums: Fetching the beautifulhugo theme [Read More]
Categories: Hugo  Tags: theme beautifulhugo