Category: system admin

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 on Linux

fzf is a serious timesaver. To be able to quickly go through past commands and in a fuzzy manner, especially when you don’t recall the exact command is a Godsend!

To install fzf on Linux, we need to

a) clone the repository into the system

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

b) run the command which will add the relevant shortcut keys

~/.fzf/install --all

There are a bunch of other stuff that can be done once fzf is installed. For example, to see instant file previews –

fzf --preview 'less {}'

And if there is bat also installed, then the previews can show syntax highlighting and line numbers also!

fzf --preview 'bat --color=always --style=numbers --line-range=:100 {}'

Windows – Path changes not updating

Multiple times when I change the path on Windows, via the ‘Environment Settings’ dialog, those changes don’t apply.

Even when I reopen the command prompt, the settings don’t seem to be there.

So, either I would log out of Windows completely and log back in or do a system restart. This was a big pain and God knows how much time I’ve wasted with this!

Recently, I got tired of this and decided to dig in a bit deeper and finally found the answer!

Continue reading

upgrading bitwarden / vaultwarden

I had posted earlier about running Vaultwarden (a Bitwarden server in Rust). This has been running amazingly all this time.

But today, when I tried to log in from the browser extension, I kept getting an error.

Searching in the forum, I found the issue – I had to update the Vaultwarden server.

Since I was running Vaultwarden as a Docker container, and I had run the docker command directly, so I decided to create a docker-compose.yml file instead this time.

Continue reading

Nginx – folders as subdomains

I have a projects folder in which I put multiple folders, each having an html page.

So, the folder hierarchy looks something like this –

projects
|-sampleproject1
  |-index.html
  |-style.css
|-sampleproject2
  |-index.html
  |-style.css

I want to have each of these folders as subdomains to my domain, so I had to create an nginx conf file for each one with a different root path.

I was looking for way to have this done automatically using Nginx and finally found it!

Continue reading

Postgres pg_dump without password

I have to do a dump of a Postgres database on a regular basis.

So pg_dump is the obvious choice to do this as is cron to do this periodically.

But the main problem with this is – pg_dump expects a password to be entered at the prompt. There’s no way to pass the password in the prompt to be able to do this.

Stackoverflow to the rescue.

What is required is a .pgpass file in the home directory.

Continue reading

How to generate SSH Keys and avoid “Invalid privatekey” error

I’ve long been a user of DBeaver which works so well across different OSes, so recently I wanted to set up the cloud version called cloudbeaver.

In the course of doing that, I had to generate SSH keys to be able to access remote databases via SSH.

Generate an SSH keypair

The standard way of generating SSH keys is to run this command.

> ssh-keygen -t rsa

This by default creates id_rsa and id_rsa.pub under <home directory>/.ssh folder (both in Windows and Linux)

Continue reading

PM2 logrotate

One of the things I forgot when I wrote the PM2 post is that PM2 creates logs. And these logs get very big, very fast!!

The pm2-logrotate takes care of this.

To install pm2-logrotate

$> pm2 install pm2-logrotate

The defaults work perfectly fine. It will retain logs for 30 days and rotate the log every day, each with a max-size of 10 MB.

To change any of these settings –

$> pm2 set pm2-logrotate:max_size 1K (1KB)
$> pm2 set pm2-logrotate:compress true (compress logs when rotated)
$> pm2 set pm2-logrotate:rotateInterval '*/1 * * * *' (force rotate every minute)

Copyright © 2024 the möbius trip

Theme by Anders NorenUp ↑