Skip to content

Instantly share code, notes, and snippets.

View rajshrimohanks's full-sized avatar
🏠
Working from home

Rajshri Mohan K S rajshrimohanks

🏠
Working from home
View GitHub Profile
@rajshrimohanks
rajshrimohanks / cleanup-old-docker-images.sh
Created September 26, 2023 10:48
Clean up old Docker images in GCR
docker run -v "${HOME}/.config/gcloud:/.config/gcloud" -it us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli -grace "720h" -repo us.gcr.io/<project> -recursive -keep 10 -tag-filter-any "^.*$"
@rajshrimohanks
rajshrimohanks / persist-resolv.conf-wsl.sh
Created May 25, 2022 07:50
Prevents WSL2 from overwriting resolv.conf everytime and persists the resolv.conf file.
#!/usr/bin/env bash
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
# Make resolv.conf immutable so that the OS can't change it.
# If you'd like to make changes to this file later, you've to
# make it mutable again by issuing the following command:
# sudo chattr -i /etc/resolv.conf
sudo chattr +i /etc/resolv.conf
@rajshrimohanks
rajshrimohanks / standard.sh
Created April 8, 2021 16:57 — forked from hfossli/standard.sh
Standard bash script format
#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"

Objective

The goal is being able to mix your microphone and desktop audio into a single track, while leaving Discord out of the equation. This allows you to stream your desktop audio and talk while in a call, without your partners hearing themselves.

Voicemeeter Setup

Download Voicemeeter

Voicemeeter Banana

@rajshrimohanks
rajshrimohanks / resize-part.sh
Created September 15, 2020 08:20
When we set up Ubuntu Server 20.04, sometimes the installer does not use the full disk space for the root partition even though we configure it to do so. Use these commands to fix it after setup.
#!/usr/bin/env bash
# Resize logical volume to use all the existing and free space of the volume group
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# Resize file system to use all available space in logical volume
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
# This should do the trick!
@rajshrimohanks
rajshrimohanks / gdrive-download.sh
Last active November 26, 2019 02:44 — forked from amit-chahar/download-script.sh
Scirpt to download files from Google drive using curl (Detailed explanation can be read here: https://stackoverflow.com/a/49444877/4043524)
#!/usr/bin/env bash
# Usage: bash gdrive-download.sh <fileid> <filename>
fileid=$1
filename=$2
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename}
@rajshrimohanks
rajshrimohanks / Virtual Box Host Only Static IP.md
Created September 16, 2019 20:14 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary

@rajshrimohanks
rajshrimohanks / color-this-sofa-svg-blend-mode-trick.markdown
Last active April 23, 2021 21:04
Color this sofa! – SVG + Blend Mode trick

Color this sofa! – SVG + Blend Mode trick

A simple spell, but quite effective.

What you want is a PNG of an object,

You want to save it as a specific size (1000px for instance)

You then want to draw an SVG vector around the section you want to color change. This section on the PNG should be photoshopped white.

@rajshrimohanks
rajshrimohanks / server.badbots
Created June 7, 2019 10:29 — forked from hans2103/server.badbots
NGINX to block bad bots. (add Twenga|TwengaBot if you want to exclude them too)
if ($http_user_agent ~* (360Spider|80legs.com|Abonti|AcoonBot|Acunetix|adbeat_bot|AddThis.com|adidxbot|ADmantX|AhrefsBot|AngloINFO|Antelope|Applebot|BaiduSpider|BeetleBot|billigerbot|binlar|bitlybot|BlackWidow|BLP_bbot|BoardReader|Bolt\ 0|BOT\ for\ JCE|Bot\ mailto\:craftbot@yahoo\.com|casper|CazoodleBot|CCBot|checkprivacy|ChinaClaw|chromeframe|Clerkbot|Cliqzbot|clshttp|CommonCrawler|comodo|CPython|crawler4j|Crawlera|CRAZYWEBCRAWLER|Curious|Curl|Custo|CWS_proxy|Default\ Browser\ 0|diavol|DigExt|Digincore|DIIbot|discobot|DISCo|DoCoMo|DotBot|Download\ Demon|DTS.Agent|EasouSpider|eCatch|ecxi|EirGrabber|Elmer|EmailCollector|EmailSiphon|EmailWolf|Exabot|ExaleadCloudView|ExpertSearchSpider|ExpertSearch|Express\ WebPictures|ExtractorPro|extract|EyeNetIE|Ezooms|F2S|FastSeek|feedfinder|FeedlyBot|FHscan|finbot|Flamingo_SearchEngine|FlappyBot|FlashGet|flicky|Flipboard|g00g1e|Genieo|genieo|GetRight|GetWeb\!|GigablastOpenSource|GozaikBot|Go\!Zilla|Go\-Ahead\-Got\-It|GrabNet|grab|Grafula|GrapeshotCrawler|GTB5|GT\:\:WWW|Guzz
@rajshrimohanks
rajshrimohanks / export-docker-container-as-tar.txt
Created June 3, 2019 09:45
Export Docker container filesystem as tar (works when stopped too)
// docker container export -o <filename.tar> <container-id>
Example:
docker container export -o ~/backend-fs.tar 854fa1d88b6b