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 / macos-network-reset.md
Created June 30, 2026 13:40
Reset MacOS Network

macOS Network Reset Script

This script requires administrator privileges for portions of the reset process. Run it as your normal user account, not with sudo. The script will request administrator authentication when necessary and maintain the session for the duration of execution.

A shell script to back up and reset macOS network configuration without wiping the Mac.

The script creates a timestamped backup of network-related configuration and state, then walks the user through each reset step interactively. Before each destructive or disruptive action, it explains what will happen and waits for the user to press any key or Enter.

What this script does

@varunchandak
varunchandak / resign-pr-commits.md
Last active December 1, 2025 16:04
Re-sign Unverified Commits on current branch

Re sign PR Commits Script

This script automatically re signs all commits on the current branch using your configured GPG key. It is useful when a pull request contains unverified commits and you want to replace them with verified, GPG signed commits.

The script:

  1. Detects the merge base with the target branch (default: main).
  2. Creates a backup branch before rewriting anything.
  3. Re signs every commit after that merge base.
  4. Force pushes the rewritten history to update the pull request.

🖼️ Collage Script

collage.sh is a simple command-line tool to generate a uniform photo collage from all images in the current directory.
It uses ImageMagick under the hood (montage command).


✨ Features

  • Works with JPG/JPEG/PNG images (case-insensitive).
  • Automatically detects the number of images and creates a near-square grid.
@varunchandak
varunchandak / organize-screenshots.sh
Created September 30, 2025 07:38
Organize screenshots Folder on you laptop
#!/bin/bash
# Usage: ./organize_screenshots.sh /path/to/screenshots
# Check if argument is provided
if [[ -z "$1" ]]; then
echo "❌ Error: No directory specified."
echo "Usage: $0 /path/to/screenshots"
exit 1
fi
@varunchandak
varunchandak / role-inline-to-managed.md
Created January 27, 2025 06:32
IAM Inline to Managed Policy Migration Script

IAM Inline to Managed Policy Migration Script

Overview

This Python script automates the process of converting inline IAM policies attached to roles into managed IAM policies. It ensures efficient policy reuse by identifying identical inline policies and linking them to a single managed policy. Additionally, it resolves conflicts in policy naming by appending unique timestamps when necessary.


Features

  1. Inline to Managed Policy Conversion:
  • Migrates inline policies attached to roles into managed policies.
@varunchandak
varunchandak / fetch-deprovisioned-okta-users.md
Created August 12, 2024 09:54
Python script to fetch deprovisioned users from Okta and export their email addresses to a CSV file. Handles pagination and uses Okta API tokens for authentication.

Fetch Deprovisioned Okta Users

This Python script fetches deprovisioned users from an Okta organization and exports their email addresses to a CSV file. The script handles pagination to ensure all deprovisioned users are retrieved, even if the data spans multiple pages.

Requirements

  • Python 3.7+
  • requests library

You can install the requests library using pip:

@varunchandak
varunchandak / gmail-label-colors.json
Created August 7, 2024 11:13
Gmail Label Coloring Script
{
"allowed_colors": [
{
"background": [
"#000000",
"#04502e",
"#076239",
"#094228",
"#0b4f30",
"#0b804b",
@varunchandak
varunchandak / join-multiple-vids-for-youtube.md
Created April 20, 2024 18:49
Join Multiple Videos for YouTube (with chapters)

Video Concatenation Guide with FFmpeg

This guide provides instructions on how to concatenate multiple video files using FFmpeg, add a black screen between each video, and address common timestamp issues during the concatenation process.

Requirements

  • FFmpeg installed on your system.
  • Videos to be concatenated should be in the same codec, resolution, and frame rate.

Steps

@varunchandak
varunchandak / inactive-users-N-days.md
Created April 16, 2024 07:59
Fetch Inactive users in Azure Entra ID Tenant for last N days

Azure Inactive User Audit Tool

This tool helps identify inactive users in an Azure AD environment by utilizing Azure CLI to fetch sign-in logs and a Python script to analyze these logs.

Functionality

  • Azure CLI Command: Fetches sign-in activity logs.
    az monitor activity-log list --offset 180d --query "[?contains(operationName.value, 'SignIn')]"
  • Python Script: Analyzes sign-in logs to determine which users have not been active within a specified number of days.
@varunchandak
varunchandak / aws-org-reinvite-accounts-to-org.md
Last active March 15, 2024 05:08
aws-org-reinvite-accounts-to-org

AWS Organization Handshake Management Script

This script is designed to manage AWS Organization handshakes by filtering for open invitations and then canceling and re-inviting the accounts. It automates the process of handling account invitations within an AWS Organization, ensuring that only current and relevant invitations are active.

Features

  • Filter Open Invitations: The script filters for handshakes that are in an 'OPEN' state and of the 'INVITE' action type, indicating pending invitations.
  • Cancel and Re-invite: For each open invitation, the script cancels the existing handshake and immediately sends a new invitation to the account.

How It Works