Skip to content

Instantly share code, notes, and snippets.

View pnsinha's full-sized avatar

P. Sinha pnsinha

View GitHub Profile
1) ==== Autossh using systemd ====
Example from
https://gist.github.com/drmalex07/c0f9304deea566842490
2) =============
Install autossh
@pnsinha
pnsinha / mvRsync.sh
Last active February 21, 2024 21:54
rsync Permissions
#https://unix.stackexchange.com/questions/43957/using-rsync-to-move-not-copy-files-between-directories
#!/usr/bin/bash
echo -e "Would you like to use a relative path to your source?[y/n?]\n"
read ans
if [[ $ans == y ]]; then
echo -e "Relative source?\n"
read source
source="`pwd`/$source"
@pnsinha
pnsinha / easybuild_latest
Last active February 1, 2024 01:30
easybuild
eb --install-latest-eb-release --prefix /software/easybuild --allow-modules-tool-mismatch
export PATH=/software/lmod-8.7.24/lmod/libexec:$PATH
source /software/lmod-8.7.24/lmod/lmod/init/bash
export LMOD_CMD=/software/lmod-8.7.24/lmod/lmod/libexec/lmod
@pnsinha
pnsinha / code-tunnel
Created January 30, 2024 19:19
code-tunnel using fish
code tunnel > ct_out 2> tc_err &; disown
@pnsinha
pnsinha / kitty.md
Created January 11, 2024 05:21
Kitty CheatSheet

Default shortcuts

Scrolling

Action Shortcut
Scroll line up ctrl+shift+up (also ⌥+⌘+⇞ and ⌘+↑ on macOS)
Scroll line down ctrl+shift+down (also ⌥+⌘+⇟ and ⌘+↓ on macOS)
Scroll page up ctrl+shift+page_up (also ⌘+⇞ on macOS)
Scroll page down ctrl+shift+page_down (also ⌘+⇟ on macOS)
@pnsinha
pnsinha / install-singularity.sh
Last active November 27, 2023 05:16 — forked from cory-weller/install-singularity.sh
Script to install singularity
#!/usr/bin/env bash
# prereqs
sudo apt update -y && sudo apt install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
@pnsinha
pnsinha / How to use ssh-copy-id.md
Created November 12, 2023 05:29 — forked from CharlesGodwin/How to use ssh-copy-id.md
Windows 10/11 scripts to support ssh-copy-id which is missing in Windows OpenSSH

The Windows version of OpenSSH client doesn't include a ssh-copy-id command. I don't know why. If it does one day, then this can be ignored.

NOTE If you have Windows Subsystem for Linux (WSL) installed, you can use the linux version of ssh-copy-id instead. Go to the description at the end of this document.

  • Download the file ssh-copy-id.cmd to your Windows PC, or copy and paste its contents.
  • Run the script passing your linux ssh information (for example ssh-copy-id.cmd pi@raspberrypi.local). This should work with any Linux platform. Alternatively, if you have experience, you can use the powershell version. ssh-copy-id.ps1. Run the script as powershell .\ssh-copy-id.ps1 pi@raspberrypi.local.
  • Run the command for each linux account you connect with. You will be prompted for your Linux host password. If you have more than 1 account on any machine, you must do this for each account.

The file name and location of the script is not important but the filename extension must be .cmd

@pnsinha
pnsinha / wsl2_gentoo
Created July 19, 2023 15:04
gentoo in wsl
wget https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20230716T164653Z/stage3-amd64-desktop-openrc-20230716T164653Z.tar.xz
wsl --import Gentoo C:\Users\parma\AppData\Local\Packages\Gentoo\ .\stage3-amd64-desktop-openrc-20230716T164653Z.tar.xz --version 2
wsl -d Gentoo
#start root session
wsl -u root -d Gentoo

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

cd /etc/resolvconf/resolv.conf.d
sudo cp -p head head.orig #backup copy, always do this
#sudo nano head
#nameserver <ip_of_nameserver>
echo "nameserver 8.8.8.8" | sudo tee -a head
#regenerate resolvconf
sudo resolvconf -u