Skip to content

Instantly share code, notes, and snippets.

@sainak
sainak / sshmap.md
Last active August 6, 2024 17:11
bash oneliner to quicly scan lan for open ssh servers
seq 1 254 | xargs -P255 -I{} bash -c 'ip="192.168.1.{}"; ping -c 1 -W 1 $ip >/dev/null 2>&1 && { nc -z -w 1 $ip 22 2>/dev/null && echo "$ip: Port 22 is open" || echo "$ip: Port 22 is closed"; }' | sort -n -t . -k 4,4
@sainak
sainak / invoice.gs
Last active April 25, 2024 22:38
Google appscript to fill invoice template
// enable drive api service
// manually set a time-driven trigger(the alarm icon) that runs monthly after 25th evening,
function deIndent(str) {
return str.replace(/^[ \t]+/gm, "");
}
function dateWithOrdinalSuffix(date) {
const day = date.getDate();
let suffix = "th";
#!/usr/bin/env bash
# Util to set up displays using displayplacer: https://github.com/jakehilborn/displayplacer
# to get the display id run `displayplacer list | grep -A2 Serial`
DISPLAY_1=s4251086178
DISPLAY_2=s261348
if [ "$#" -ne 1 ]; then
@sainak
sainak / 50-cloud-init.yaml
Last active February 9, 2024 06:16
Netplan configuration for network interface failover.
network:
version: 2
ethernets:
enp9s0:
dhcp4: false
wifis:
wlan0:
access-points:
"wifi":
password: "pass"
@sainak
sainak / icon.url
Created November 8, 2023 12:34
pake youtube music patch
# https://macosicons.com
https://parsefiles.back4app.com/JPaQcFfEEQ1ePBxbf6wvzkPMEqKYHhPYv8boI1Rc/6ba4356c379a0e212b2af5a8ef1a57ef_YouTube%20Music.icns
@sainak
sainak / README.md
Last active June 26, 2022 16:59
pacman hook to update the default chrome desktop entry with custom profiles

pacman hook to update the default chrome desktop entry with custom profiles

To see the available profiles run:

cat ~/.config/google-chrome/Local\ State  | jq .profile

Paste the hook in /etc/pacman.d/hooks/google-chrome-shortcut-patch.hook

@sainak
sainak / 80-logitech.rules
Last active July 27, 2022 05:00
udev rule to disable wakeup from logitech devices
ACTION=="add", SUBSYSTEM=="usb", ATTR{idProduct}=="c52b", ATTR{idVendor}=="046d", ATTR{power/wakeup}="disabled"
@sainak
sainak / PKGBUILD
Last active July 26, 2021 15:40
linux-amd-zen2
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.13.5 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.1.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=110100
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23601

Better requitements.txt

install pipdeptree
pip install pipdeptree
pipdeptree -f 2>/dev/null | grep -v '^ ' | tee requirements.txt
@sainak
sainak / using-multiple-github-accounts-with-ssh-keys.md
Last active January 27, 2023 07:23 — forked from oanhnn/using-multiple-github-accounts-with-ssh-keys.md
Using multiple github accounts with ssh keys