Category: system admin

Dynamically add programs to PATH on Windows

On Windows, I always prefer to use Portable Apps. I store them in a different drive on my computer. That way, if I have to reinstall my OS, I still have all my apps available.

There’s one catch though. If I want to use the apps directly from the command line or access them programmatically, I have to give the full path to the executable. The only way around it is to update the PATH` environment variable with the directory where the portable app exists.

This gets a little painful and when restoring the system, it takes a whole bunch of time adding these to the PATH environment variable again.

It would be ideal if I had a single folder, which is added to the PATH, and I have some sorts of links or shortcuts there to launch the apps.

However, many apps require that they be run from the directory where they exist, rather than by using a shortcut or link.

To overcome this issue, we need to do things a bit differently.

Continue reading

Enable vi mode in Powershell

How did I not know about this capability?

This is the one thing that I used to miss in Powershell all this while. And just recently I got to know that this can be enabled very simply.

vi mode can be enabled in the profile by adding this –

# Enable Vi editing mode
Set-PSReadLineOption -EditMode Vi

Run caddy as a non-root user on Ubuntu

Any process can be run as a non-root user service.

The first criteria to have a service as a non-root user is to have the service be kept running even when the user is not logged in.

However, having a web server places an additional challenge – port 80 and port 443 which are basically the http and the https ports need to be bound by a user with administrative privileges because they are lower ports.

Continue reading

Restrict access to part of path in Nginx

So, I have a site, let’s call it example.com. But I have multiple levels of directories under it. I have directories like /example.com/repositories and the actual repositories at the next level like so example.com/repositories/abcd or example.com/repositories/efgh.

Now, I only want access to example.com/repositories restricted. Everyone should be able to access the root level i.e. example.com and the nested subdirectories i.e. example.com/repositories/*.

Continue reading

Nginx config for SvelteKit SPA

For creating a SvelteKit SPA app, we first need to set up SvelteKit to have all the pages pre-rendered. For this, for every +page.svelte we need to add a +page.server.ts or a +page.server.js with the following –

export const prerender = true;
export const ssr = true;

This will create the corresponding pages for each route. For example, if we have a URL like example.com/about, we will have an about.html page getting created.

However, putting the build folder directly under a simple nginx config doesn’t work. Since the URL does not have an .html extension, even if those pages are there, nginx doesn’t show them.

Continue reading

Powershell – find alias or function in profile by pattern

Since I have lots of aliases and functions in my profile, frequently I need to search them by some pattern.

This Powershell function lets me do just that.

function ff {
  param(
    [string]$Pattern
  )

  # Define the path to the PowerShell profile
  $profilePath = $PROFILE

  # Check if the profile exists
  if (-not (Test-Path $profilePath)) {
    Write-Host "Profile script does not exist at $profilePath"
    return
  }

  # Define the patterns to search for aliases and functions
  $patterns = "Set-Alias.*$Pattern", "New-Alias.*$Pattern", "function.*$Pattern"

  # Search the profile for the specified pattern
  # Select-String -Path $profilePath -Pattern $patterns
  Select-String -Path $profilePath $patterns
}

Now, all I need to do is type this to find the matching line and the actual function in my profile.

> ff <pattern>

Ruby OpenSSL::SSL::SSLError – SSL_connect returned=1 errno=0 unsafe legacy renegotiation disabled

So, all of a sudden, one of our servers, while trying to connect to another, started giving this cryptic error –

OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 unsafe legacy renegotiation disabled

These kind of errors are usually dependent on some system updates. But the error seemed to be coming from the target server. After a bit of searching around, this article gave the most understandable information.

From that article –

This “unsafe legacy renegotiation disabled” error happens when connecting to outdated endpoints that do not support RFC 5746 secure renegotiation. Ideally, the endpoints causing these errors should be upgraded for security reasons. 

In the same article, they mention that it should be possible to remove this security check, but the solutions mentioned there didn’t work.

Continue reading

fzf – error when pressing Ctrl+R

I’ve become a big fan of fzf since I discovered it.

However, after a recent upgrade, when I pressed Ctrl+R, I got the following error –

unknown option: --scheme=history

After some searching, found the following solution.

Remove fzf from /usr/bin/ and relink it.

Run these two commands in order –

sudo rm /usr/bin/fzf
sudo ln -s ~/.fzf/bin/fzf /usr/bin/fzf

Install fzf for Powershell on Windows

Since I installed fzf on Linux, I also wanted it in my Windows Powershell prompt.

To install fzf

winget install fzf

And then to get keyboard shortcuts working, following lines need to be added in the profile.ps1

Remove-PSReadlineKeyHandler 'Ctrl+r'
Remove-PSReadlineKeyHandler 'Ctrl+t'
Import-Module PSFzf

Copyright © 2026 the möbius trip

Theme by Anders NorenUp ↑