Skip to content

Instantly share code, notes, and snippets.

View pnsinha's full-sized avatar

P. Sinha pnsinha

View GitHub Profile
@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 [email protected]). 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 [email protected].
  • 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
@pnsinha
pnsinha / installs.ps1
Created June 16, 2022 05:20 — forked from jimbrig/installs.ps1
Scoop Configuration and Installation for R
# check execution policy
If ((Get-ExecutionPolicy) -eq 'Restricted') {
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
}
# check powershell $PROFILE
If (!(Test-Path $PROFILE)) {
Write-Host "No PowerShell $PROFILE detected, creating one.." -ForegroundColor Magenta
New-Item -ItemType File -Path $PROFILE -Force
Write-Host "Created PowerShell Profile at: $PROFILE" -ForegroundColor Green
@pnsinha
pnsinha / lxc-create.sh
Created May 30, 2022 11:47 — forked from gigadot/lxc-create.sh
Create LXC and Bridge with LAN interface
#/bin/bash
# Check if bridge-nf-call-iptables is enabled (1 if enabled)
# cat /proc/sys/net/bridge/bridge-nf-call-iptables
# Enable IP Forwarding
# echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
# sysctl --system
CONTAINER_NAME=kube
BRIDGED_NAME=br0