Skip to content

Instantly share code, notes, and snippets.

View xbalaji's full-sized avatar

Balaji (xbalaji) V xbalaji

View GitHub Profile
@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 ([email protected])
# 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 December 15, 2024 07:09
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 7, 2024 01:15
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 August 1, 2020 19:41
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
cp containers.json c01.json
jq -r '.' c01.json | tr -d '\r' | tac | sed '/name.*tmp/{n;N;N;N;N;d}' | tac | sed '/name.*tmp/,+1d' | yq '.' | jq '.identities|=sort_by(.name)' > containers.json
preserve=""
for id in $(jq -r '.identities[] | .userContextId' containers.json | tr -d '\r' | sort -rn); do
preserve="$id\|$preserve"
@xbalaji
xbalaji / jenkins-utils-functions.sh
Last active October 28, 2022 00:46
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"
@xbalaji
xbalaji / jenkins-groovy-notes.md
Created July 11, 2020 06:34
jenkins-groovy-notes.md

execute the scripts http://jenkins-server/script

For simple jobs

def jobName = "xb-nodetest"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.updateNextBuildNumber(1)
job.save()