How to check TLS/SSL expiry using command line (OpenSSL)
If you're responsible for managing websites or servers, it's important to keep track of when your SSL/TLS certificates are going to expire. Failure to renew your certificate before it expires can lead to downtime, security issues, and other problems. Thankfully, it's easy to check the expiry date of your SSL/TLS certificate using the OpenSSL command-line tool.
If you are on Windows
If you use Windows 10 or 11, you need to install OpenSSL. You can download and install the binary from HERE
How to send commands to nested tmux sessions
TL;DR : Press the prefix key twice
In this short blog post, we'll explore how to send tmux commands to a remote session while working within a local tmux session using the same prefix key.
That is, you have a local tmux session, you have connected to a remote host via ssh within this tmux session and now you have opened a new tmux session within that.
This scenario creates a "nested" tmux session. To send commands to the remote tmux session without changing the prefix key, you simply need to press the prefix key twice.
How to Turn Off Your Laptop Screen Without Closing the Lid on Windows 11
Introduction:
If you're using a laptop with an external monitor, there may be times when you want to turn off your laptop screen without closing the lid. This can be particularly useful for gaming laptops that draw air through the keyboard, as closing the lid can lead to overheating. In Windows 11, the setting to disable a display may not be immediately obvious, but it's actually quite simple to do. In this blog post, we'll walk you through the process step by step.
Using a specific version of NodeJS in Github Actions
This post is from April 2023; the example uses end-of-life Node.js 16 and an old version of actions/setup-node. Choose currently supported versions instead.
If you want to use a specific version of NodeJS in your Github Actions runner image, you don't have to install it yourself, just gotta ask it nicely. Here is how you can do it.
Just add a step that us using the actions/setup-node to choose the node version and you are good to go
Fix error while installing NodeJS
This post is from April 2023; it addresses a specific Node.js 12/16 package conflict, and its Node.js 18 installation example is now end-of-life. Check your installed packages and current Node.js guidance before using these commands.
The Error
If you are seeing the following error when trying to install NodeJS, I have an easy solution for you. This is the error
Preparing to unpack .../nodejs_16.20.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.20.0-deb-1nodesource1) over (12.22.9~dfsg-1ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.20.0-deb-1nodesource1_amd64.deb (--unpack):
trying to overwrite '/usr/include/node/common.gypi', which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_16.20.0-deb-1nodesource1_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
Error: Process completed with exit code 100.The Solution
cd /etc/apt/sources.list.d
sudo rm nodesource.list
sudo apt --fix-broken install
sudo apt update
sudo apt remove nodejs
sudo apt remove nodejs-docAnd now install the version of NodeJS you wanted. Example
Not able to access hosts over SSH : no matching host key type found
This post is from April 2023; its
Host *example re-enables legacy SHA-1 SSH signatures for every SSH host. Avoid applying it globally; if necessary, limit the exception to a specific trusted host.
This happens because in newer versions of the OpenSSH client the ssh-rsa key exchange algorithm (specifically the SHA1 signature - more info here) is no longer trusted by default.
If you are using anything newer than OpenSSH_8.8p1, OpenSSL 1.1.1l 24 Aug 2021 and are facing the following error while trying to ssh
Fixing 'alacritty': unknown terminal type. in ssh session
The Problem
You are using Alacritty terminal and you have logged into a remote host via ssh and when you try to type a command like clear it says this:
'alacritty': unknown terminal type.The Solution
Just change your ssh command to TERM=xterm-256color ssh. That is, add an alias.
Edit your shell's RC file.
ZSH - ~/.zshrc
BASH - ~/.bashrc
alias ssh='TERM=xterm-256color ssh'And source your shell's rc file.
source ~/.zshrcYou should be all set now
Persisting SSH Keys (ssh-agent) across terminals (Windows and Linux)
The easiest way to persist ssh keys across different terminal sessions is to use the keychain tool.
Install keychain
Depending on your operating system, the command will vary
Ubuntu and Debian Derivatives
sudo apt update
sudo apt install keychain
Fedora
sudo dnf install keychainArch Linux
sudo pacman -S keychainConfigure Keychain to persist ssh agent
Open /.zshrc or /.bashrc depending on your shell, and add the following entry to it
eval `keychain --eval --agents ssh id_rsa id_rsa_1`Here, I am adding two keys id_rsa and id_rsa_1.
How to create Ubuntu (or any Linux) bootable USB
After trying so many different tools, I have settled on using Balena Etcher for all my bootable USB needs. It could not be any simpler
Step 1 : Download Balena Etcher
Go HERE and download the latest version of Balena Etcher and install it on your computer.
Step 2 : Run it
This is obvious, you run it, select the iso you want to flash, select the drive you want to flash and then just Flash!