Skip to content

Instantly share code, notes, and snippets.

View madhurprash's full-sized avatar

Madhur Prashant madhurprash

View GitHub Profile
@madhurprash
madhurprash / qwen_cmi_bedrock.py
Last active September 4, 2025 15:57
Use Custom Model Import (CMI) on Bedrock
"""
AWS Bedrock Custom Model Import - Qwen Models
"""
import os
import json
import boto3
import base64
import time
from typing import Dict, List, Optional
@madhurprash
madhurprash / download_phi4_to_s3.py
Created July 25, 2025 15:57
Script to download Microsoft Phi-4-mini-instruct model from Hugging Face and upload it to S3 for SageMaker use.
#!/usr/bin/env python3
"""
Script to download Microsoft Phi-4-mini-instruct model from Hugging Face
and upload it to S3 for SageMaker use.
"""
import os
import tempfile
import shutil
from pathlib import Path
@madhurprash
madhurprash / strands_bedrock_langfuse.py
Created July 18, 2025 17:57
Observability of a strands agent using langfuse
#!/usr/bin/env python3
"""
Strands Agent with Langfuse Observability - Terminal Version
This script demonstrates how to monitor and debug your Strands Agent using Langfuse.
"""
import os
import sys
import base64
import boto3
@madhurprash
madhurprash / get_latest_image_uri.py
Created July 9, 2025 21:13
This gist gets the latest image uri based on the registry id and the repo id. View an example below.
import boto3
from botocore.config import Config
def get_latest_image_uri(registry_id: str,
repository_name: str,
region: str = "us-east-1") -> str:
"""
Fetch the URI of the most recently pushed image in the given ECR repository.
"""
ecr = boto3.client("ecr", region_name=region, config=Config(retries={"max_attempts": 10}))
@madhurprash
madhurprash / generate_meeting_minutes_synthetic.ipynb
Created April 9, 2025 16:30
This gist generates synthetic meeting minutes, summary and counts the tokens for each. This generates a JSONL file with the meeting minutes, summaries, and token metrics.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@madhurprash
madhurprash / list_s3_uris_in_kb
Created April 2, 2025 17:15
This gist helps get insights into s3 uri's that the knowledge base has ingested as a part of its data s
import boto3
import json
from typing import Dict, List, Optional
import re
def get_detailed_s3_uris(
knowledge_base_id: str,
data_source_id: str
) -> Dict:
"""
@madhurprash
madhurprash / move_folders_within_s3
Created April 2, 2025 16:15
This gist moves folders from within the same s3 bucket to another using pythons asyncio functionality
import os
import shutil
import concurrent.futures
import boto3
from pathlib import Path
import logging
import time
def move_folders_to_combined(bucket_name, folders_to_move=["SSE", "FPA", "Hypershield"], log_level=logging.INFO):
"""
@madhurprash
madhurprash / qrcode_generator.py
Created December 11, 2024 15:33
This gist takes in a list of links and generates QRCodes for those links.
import qrcode
import logging
import re
import os
# Install the following package before running the script: pip install qrcode
# set a logger
logging.basicConfig(
format='[%(asctime)s] p%(process)s {%(filename)s:%(lineno)d} %(levelname)s - %(message)s',
@madhurprash
madhurprash / sagemaker_mlflow_simple_example.ipynb
Created November 13, 2024 17:37
In this gist, we do the following: Set up `mlflow` tracking with the SageMaker tracking server, create a simple classification experiment and use MLFlow to input logs, metrics, parameters and model with simple API calls.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@madhurprash
madhurprash / github_issues_in_csv.py
Created September 17, 2024 18:41
This gist converts github issues into csv that can be imported into Asana for sprint planning
import os
import csv
import logging
import requests
from datetime import datetime
from typing import Optional, List
logging.basicConfig(format='[%(asctime)s] p%(process)s {%(filename)s:%(lineno)d} %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)