Skip to content

Instantly share code, notes, and snippets.

View swateek's full-sized avatar
🎯
One Small Step at a Time

Swateek Jena swateek

🎯
One Small Step at a Time
View GitHub Profile
@swateek
swateek / fetch_mfa_creds.sh
Created March 4, 2026 05:00
Fetch MFA Creds
#!/usr/bin/env bash
# =============================================================================
# fetch_aws_mfa_creds.sh
# Fetches temporary AWS session credentials using an MFA token and stores
# them under a dedicated [mfa] profile in ~/.aws/credentials.
#
# Usage:
# ./fetch_aws_mfa_creds.sh <6-digit MFA token>
#
# Prerequisites:
@swateek
swateek / vagrant_cleanup.sh
Last active March 2, 2026 16:39
Vagrant Cleanup Script
#!/bin/bash
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BOLD='\033[1m'
NC='\033[0m'
# Use $HOME by default, or override with CLEANUP_HOME env var
@swateek
swateek / README.md
Created December 8, 2025 10:17
Create Calendar Events From a Simple CSV file

CSV to ICS Converter

This script converts a CSV file containing event details into an ICS file that can be imported into Google Calendar (and other calendar applications).

Usage

  1. Prepare your CSV file: The CSV file should have the following columns (case-insensitive):
    • start date (Format: YYYY-MM-DD HH:MM or YYYY-MM-DD for all-day)
  • end date (Format: YYYY-MM-DD HH:MM or YYYY-MM-DD)
@swateek
swateek / extract_http_requests.py
Created August 15, 2025 05:12
Extract HTTP Requests From an HAR File
import json
# Path to your HAR file
har_file = "example.har"
# Load HAR file
with open(har_file, "r", encoding="utf-8") as f:
har_data = json.load(f)
# HAR files store entries under log.entries
@swateek
swateek / aws_route53_management.sh
Created August 14, 2025 04:07
AWS Route53 Management Script
#!/usr/bin/env bash
set -euo pipefail
AWS_PROFILE="devops"
function hosted_zone_exists() {
local domain=$1
aws route53 list-hosted-zones-by-name \
--dns-name "$domain" \
--query "HostedZones[?Name=='${domain}.'] | length(@)" \
import { DBSQLClient } from "@databricks/sql";
import IDBSQLSession from "@databricks/sql/dist/contracts/IDBSQLSession";
interface DataBricksWareHouseConnect {
token: string;
host: string;
path: string;
}
class DataBricksManager {
@swateek
swateek / databricks_sqlwarehouse.py
Created June 18, 2025 04:02
DataBricks SQL WareHouse
from databricks import sql
DATABRICKS_USE2_PAT = ""
use2_workspace = sql.connect(
server_hostname="<YOUR-SERVER-HOSTNAME>",
http_path="<YOUR-HTTP-PATH>",
access_token=DATABRICKS_USE2_PAT,
catalog="<YOUR-CATALOG-NAME>",
schema="<YOUR-SCHEMA-NAME>"
@swateek
swateek / blobs_in_singlestore.md
Created April 17, 2025 08:20
Blobs In Singlestore
USE information_schema;

DESC MV_DATA_DISK_USAGE;

SELECT * FROM MV_DATA_DISK_USAGE;

SELECT DATABASE_NAME, FORMAT(SUM(`BLOBS_B`) / 1024/1024, 0) MB
FROM MV_DATA_DISK_USAGE
GROUP BY DATABASE_NAME
@swateek
swateek / agents.yaml
Created January 14, 2025 03:04
Crew AI with Bedrock LLMs
bedrock_agent:
role: >
Bedrock AI Assistant
goal: >
Help users generate responses using AWS Bedrock's LLM.
backstory: >
You are an advanced AI assistant powered by AWS Bedrock. You excel at processing
and generating meaningful insights from textual data.
tools:
- bedrock_tool
@swateek
swateek / working_with_jq.md
Last active August 24, 2023 07:55
working_with_jq.md

jq

  • Print all of the JSON content in a key value pair, like in an environment file.
echo '{"key1":"value1", "key2": "value2", "key3": "value3"}'\
| jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]'

echo '{"key1":"value1", "key2": "value2", "key3": "value3"}'\
| jq -r 'to_entries[] | "\(.key)=\(.value | tostring)"'