Skip to content

Instantly share code, notes, and snippets.

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

Varun Chandak varunchandak

🏠
Working from home
View GitHub Profile
@varunchandak
varunchandak / bhagawad-geeta-one-liners.md
Created June 7, 2022 09:49
bhagawad-geeta-one-liners.md

One liner Bhagawad Geeta

Chapter 1 - Wrong thinking is the only problem in life.

Chapter 2 - Right knowledge is the ultimate solution to all our problems.

Chapter 3 - Selflessness is the only way to progress and prosperity.

Chapter 4 - Every act can be an act of prayer.

@varunchandak
varunchandak / jenkins-upgrade-script.sh
Last active June 10, 2022 12:11
Automated Jenkins Upgrade Script
#!/bin/bash
# This script will auto upgrade jenkins to latest stable version if found.
export EPOCH_DATE="$(date +%s)"
export JENKINS_UPGRADE_URL="http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war"
export JENKINS_DIR="/usr/share/java"
export TEMP_DIR="/tmp/jenkins-upgrade-"$EPOCH_DATE"/"
export WEBHOOK="https://hooks.slack.com/services/XXXX/YYYY/ZZZZZ"
# Create temp directory
@varunchandak
varunchandak / delete-unused-disks-from-gcp-project.sh
Created June 23, 2022 15:15
Script to delete unused disks from GCP project
export GCP_PROJECT=<PROJECT_ID>
IFS=','
gcloud compute disks list \
--format json \
--project "$GCP_PROJECT" | \
jq -r '.[]|select(.users == null)|.name, .zone' | \
paste -d, - - | \
sed "s,https://www.googleapis.com/compute/v1/projects/$GCP_PROJECT/zones/,,g" | \
while read DISK_NAME ZONE_ID; do
@varunchandak
varunchandak / single-iam-user-with-password.yml
Created July 28, 2022 12:57
CloudFormation template provisions a single IAM User with password
AWSTemplateFormatVersion: '2010-09-09'
Description: This template provisions a single IAM User with password
Metadata:
Authors:
Description: Will Nave (will@1strategy.com)
Purpose:
Description: "This template is used to create a stack that implements a single IAM User. The user can
be associated with an IAM Group and/or one of several Managed Policies offered by AWS. Each managed policy maps
to a traditional user job function/role. The stack exports both the user name and ARN on successful
deployment."
@varunchandak
varunchandak / linkedin-connection-remover.js
Created October 24, 2022 07:42
LinkedIn Connection Bulk Remover
function stepOne(){
document.querySelector('button.mn-connection-card__dropdown-trigger.artdeco-button--tertiary.artdeco-button--muted.artdeco-button--circle.p1.artdeco-dropdown__trigger.artdeco-dropdown__trigger--placement-bottom.ember-view').click();
window.zorro++;
setTimeout(function () {
document.querySelector('button.display-flex').click();
window.zorro++;
@varunchandak
varunchandak / phrases-for-work.md
Created November 21, 2022 17:08
Phrases for Work
  • Were you BORN this stupid? Or did it just take years of practice?
  • I don't know what your problem is, but I'll bet it's hard to pronounce.
  • The beatings will continue until morale improves
  • How about never? Is never good for you?
  • I see you've set aside this special time to humiliate yourself in public.
  • Busy, you thought busy was a policeman. "In England for some reason, they call the policeman busy
  • I'm really easy to get along with once you people learn to worship.
  • I'll try being nicer if you'll try being smarter.
@varunchandak
varunchandak / create permanently delete user in powershell.md
Last active January 3, 2023 09:39
create permanently delete user in powershell
Connect-MsolService

New-MsolUser -DisplayName "User Name" -FirstName User -LastName Name -UserPrincipalName username@yourdirectory.onmicrosoft.com

get-msoluser -UserPrincipalName username@yourdirectory.onmicrosoft.com | select *immutableid*

set-MsolUser –UserPrincipalName username@yourdirectory.onmicrosoft.com -ImmutableId "username@domain.tld"

get-msoluser -UserPrincipalName username@yourdirectory.onmicrosoft.com | select *immutableid*
@varunchandak
varunchandak / GCP App Engine Static Website.md
Last active March 9, 2023 09:27
GCP App Engine Static Website app.yaml

Steps

  1. create a directory website
  2. copy the app.yaml in the website directory
  3. create a directory static inside website directory
  4. copy the contents of website inside static directory
  5. from the website directory level, deploy the website using gcloud app deploy
@varunchandak
varunchandak / make_square.md
Created October 20, 2023 04:45
A Bash script to convert an image to a square by adding equal padding to its shorter dimension using ImageMagick.

Image Square Padding Script

This script takes an image as input and converts it into a square by adding equal padding to its shorter dimension. It utilizes ImageMagick for image processing.

Usage

./make_square.sh [input_image] [output_image]

Requirements

  • ImageMagick
@varunchandak
varunchandak / gcp-org-folders-listing-script.md
Created January 14, 2024 10:56
Google Cloud Organization Folders Listing Script

Google Cloud Organization Folders Listing Script

This script is designed to recursively list all folders within a specified Google Cloud Organization. It utilizes the gcloud command-line tool to fetch and display the folder hierarchy.

Installation

Before running this script, ensure that you have the following prerequisites installed:

  1. Google Cloud SDK
  2. Bash shell (usually pre-installed on Linux and macOS)