Easy SSH and SCP Tunneling Using ProxyJump in Your SSH Config

Given a remote host “remote1.institution.edu” that has to be accessed through a gateway host, “gateway.institution.edu”, instead of issuing a complex tunnel command like: ssh -p 2222 username1@gateway.institution.edu -t username2@remote1.institution.edu you can make life a lot simpler by setting up your ~/.ssh/config file to make use of the ProxyJump feature: Host gateway HostName gateway.institution.edu User username1 Port 2222 Host remote1 HostName remote1.institution.edu User username2 ProxyJump gateway Now you can just: ssh remote1 and be done with it!

Read more

Prevent Sleep on Laptop Lid Close

This is in reference to the “hanging suspend job prevents shutdown” bug. On some more investigation, the problem seems to be with operating with the laptop lid closed (while it is plugged in to an external monitor). This is a standard usage for me. Upon booting, I usually close the lid at the login screen or after logging in. The laptop display goes off, everything gets transferred to the external monitor and life goes on an usual.

Read more

Global Package Installation With Pip

Pip has really made management of packages in a Python installation much less frustation free, though some glitches/annoyances remain. One issue I’ve found is that it is actually a little complicated to install packages modules systemwide for all users. This is the opposite of the situation in life before Pip, where it could be incredibly painful to not have system-level privileges and use global/systemwide targets when installing packages. Definitely progress, as the the “local user ecosystem” target is definitely a more useful and more common objective.

Read more

SSH-ing into a Windows WSL Linux Subsystem

Assuming you have installed and setup your favorite Linux distribution under the Windows 10 WSL, you have to make a couple of tweaks before you can actually SSH into it. A fantastic guide to making your Windows 10 PC behave like a respectable Linux dev environment which covers this and so much more can be found here. In this post, I am just extracting the SSH setup recipe with slight modifications/extensions (publishing it here for my own quick and stable reference, if nothing else):

Read more

Print Table File Field Info

Given a delimited table file with the first row being field (column) names, print the field names as a list: awk 'NR==1{for (i=1;i<=NF;i++) print $i}' file.tsv With numbering: awk -F '\t' 'NR==1{for (i=1;i<=NF;i++) printf("%02d: %s\n", i, $i)}' file.

Read more

Merge Multiple Files With Header Rows

AWK / BASH one-liner to merge multiple files skipping the first row of each file except the first file, skipping blank lines (useful for concatenating table/data files where the first row is a header): awk 'NF==0 || (FNR==1 && NR!=1){next;}{print}' file1.txt file2.txt .

Read more

'Found existing installation', 'Not uninstalling', and 'Can[not] uninstall' Error Messages When Using 'Pip' to Install from a Local Filesystem

When running “pip” to install a package from a local file system, do you get messages like “Found existing installation package_name”, “Not uninstalling package_name”, “Can’t uninstall ‘package_name’“, “No files were found to uninstall”? This could be because you are trying to install the package from within the package root directory, and “pip” is confusing the (ephemeral/coincidental) package availability from the current working directory with the package being installed and available globally.

Read more

Bash Script Automatic Exit on Command Failure

Stick this at the top of your multi-command BASH job scripts: set -e -o pipefail Exits on failure (== non-0 return code from any commands in the script) instead of cheerfully executing all subsequent lines in what is bound to result in a cascade of errors (or worse). More information in the excellent post here.

Read more

Configuring that Vim Build

Because I always forget and need to look it up all the time, ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-pythoninterp=yes \ --enable-python3interp=yes \ --enable-perlinterp=yes \ --enable-luainterp=yes \ --enable-gui=gtk2 \ --enable-cscope \ --prefix=$HOME/Environment/local \

Read more

You Are Only as Good as Your Next Resurrection (Part 3)

(NOTE: This is the third of a three part series on setting up a cloud-based backup system, and describes how to set up the backup system to run on schedule automatically. The first describes the rationale behind the various technologies selected for the system, while the second describes how to setup and use the backup system) From a Backup to a Backup System Ok, with all the above we just have the building blocks of a backup system.

Read more