Skip to content

Instantly share code, notes, and snippets.

View xbalaji's full-sized avatar

Balaji (xbalaji) V xbalaji

View GitHub Profile
@xbalaji
xbalaji / create-dir-rename-find.sh
Created July 25, 2022 06:21
create-dir-rename-find.sh
#! /usr/bin/bash
mkdir -p Torrent/Self\ help_Pack\ {00..04}/{,{English,German}\ Author{01..3}}
touch Torrent/Self\ help_Pack\ {00..04}/{,{English,German}\ Author{01..3}}/book.pdf
mkdir -p Torrent/python\ for_datascience
touch Torrent/python\ for_datascience/python\ for_datascience.pdf
mkdir -p Torrent/yoga_the_art-of-science
touch Torrent/yoga_the_art-of-science/yoga_the_art-of-science-files{01..03}.pdf
@xbalaji
xbalaji / TorrentFileMassage.sh
Last active July 24, 2022 03:19
TorrentFileMassage.sh
#! /usr/bin/env bash
SEQ_NUM="01"
# generate directories list
ORG_DIRS="./org-dirs${SEQ_NUM}.txt" # original dirs list
GEN_DIRS="./gen-dirs${SEQ_NUM}.txt" # generated dirs list
MV_DIRSH="./move-dirs${SEQ_NUM}.sh"
#find TorrentDownload/ -maxdepth 1 -type d -name "* *" > "${ORG_DIRS}"
@xbalaji
xbalaji / conditional.tf
Created March 11, 2022 07:14
execute conditional logic and exit terraform execution - exception
#
# Filename : condition.tf
# Date : 04 Mar 2022
# Author : Balaji Venkataraman (xbalaji@gmail.com)
# Description : terraform script to push updated modules to registry
#
#
# case 1:
# $terraform plan
#
# files modified in the last commit
git diff --name-only HEAD HEAD~1
# files modified in the last 5 commits
git diff --name-only HEAD HEAD~5
# files modified in the last 6 commits in a specific directory
git diff --name-only HEAD HEAD~6 | grep modules
# directories modified in the last 6 commits in a specific sub-folder in a specific directory
@xbalaji
xbalaji / brew-packages-list.sh
Created March 24, 2021 04:16
brew-packages-list.sh
# generated using: $(brew leaves; brew list --cask) | sort > packages-list
# install:
# curl -skL "https://gist.github.com/xbalaji/b4902d26d7740b61947c7d6af6196412/raw/brew-packages-list.sh" | grep -v '^#' | xargs brew install
adoptopenjdk
awscli
bash
brew-gem
ccleaner
cloudfoundry/tap/cf-cli
cmake
@xbalaji
xbalaji / wsl-notes.md
Last active April 15, 2026 05:16
wsl-notes.md
@xbalaji
xbalaji / oneliners-twilio.sh
Last active February 24, 2021 04:20
oneliners-twilio.sh
# https://support.twilio.com/hc/en-us/articles/223136027-Auth-Tokens-and-How-to-Change-Them
export TWILIO_ACCOUNT_SID="AC..."
export TWILIO_AUTH_TOKEN="e3.."
twilio-phone-get()
{
num=$(echo ${*} | tr -d [:space:])
[[ "$num" =~ ^[0-9].* ]] && num="+1${num}"
echo $num
@xbalaji
xbalaji / oneliners-bash.sh
Last active March 16, 2026 04:41
oneliners-bash
# split a file (sp500.csv) with 101 lines each with numeric suffixes and additional extension suffixes
split --numeric-suffixes=1 -l 101 sp500.csv stock --additional-suffix=".csv"; ls stock*.csv
# the output is as below
stock01.csv stock02.csv stock03.csv stock04.csv stock05.csv
# gnome graphical font size
# fontsize 1.5 <-- to make it bigger
# fontsize <-- to reset to normal
# fontsize 0.7 <-- to make it smaller
@xbalaji
xbalaji / firefox-delete-temporary-containers.sh
Last active September 21, 2025 06:31
firefox-delete-temporary-containers.sh
#!/bin/bash
# cleanup containers.json (remove tmp containers, sort them by name)
# open command prompt in profiles directory and execute
# only have the non-tmp containers
jq '.' containers.json > c01.json
jq '.identities |= map(select(.name | test("^tmp") | not)) | .identities |= sort_by(.name) | .' c01.json > containers.json
# Construct the grep pattern with 'userContextId=' for each userContextId from JSON for just the tmp containers
@xbalaji
xbalaji / jenkins-utils-functions.sh
Last active December 28, 2025 00:59
jenkins-utils-functions.sh
# source this file and use the functions, download the jenkins-cli.jar first
export JENKINS_SERVER=localhost
export JENKINS_PORT=8080
export JENKINS_USER='admin'
export JENKINS_PASS='admin'
export JENKINS_PROTO='http'
export JENKINS_JOBDIR="jenkins-jobs"
jenkins_urlhelp() {
echo "copy, change and paste for customization"