Skip to content

Instantly share code, notes, and snippets.

View saxenanurag's full-sized avatar
🐍
import this

Anurag Saxena saxenanurag

🐍
import this
View GitHub Profile
@saxenanurag
saxenanurag / resize-image-keep-aspect-ratio.py
Created September 24, 2020 18:55 — forked from tomvon/resize-image-keep-aspect-ratio.py
Python script to resize an image while keeping the original aspect ratio.
#Resizes an image and keeps aspect ratio. Set mywidth to the desired with in pixels.
import PIL
from PIL import Image
mywidth = 300
img = Image.open('someimage.jpg')
wpercent = (mywidth/float(img.size[0]))
hsize = int((float(img.size[1])*float(wpercent)))
# Read more about setting it up
# https://medium.com/@ljmocic/deploying-react-application-to-aws-s3-using-github-actions-85addacaeace
on:
push:
tags:
- '*'
jobs:
build:
@saxenanurag
saxenanurag / devops_best_practices.md
Created April 11, 2022 00:29 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, at the Agile Conference in Toronto, Andrew Shafer posted an offer to moderate an ad hoc "Birds of a Feather" meeting to discuss the topic of "Agile Infrastructure". Only one person showed up to discuss the topic: Patrick Debois. Their discussions and sharing of ideas with others advanced the concept of "agile systems administration". In that same year, Debois and Shafer formed an Agile Systems Administrator group on Google, with limited success. Patrick Debois did a presentation called "Infrastructure and Operations" addressing issues around involving more of the comp

@saxenanurag
saxenanurag / get_memory_size.py
Created January 19, 2025 20:46 — forked from philschmid/get_memory_size.py
Get needed GPU per precision for a Hugging Face Model Id
from typing import Dict, Union
from huggingface_hub import get_safetensors_metadata
import argparse
import sys
# Example:
# python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct
# Dictionary mapping dtype strings to their byte sizes
bytes_per_dtype: Dict[str, float] = {
@saxenanurag
saxenanurag / hybrid_reranker.py
Created August 7, 2025 20:27 — forked from ccf-saxenaa/hybrid_reranker.py
Hybrid search with RRF and re-ranker with Azure Postgres
import os
from pathlib import Path
import dotenv
import psycopg2
from azure.identity import DefaultAzureCredential
from dotenv import load_dotenv
from pgvector.psycopg2 import register_vector
dotenv.load_dotenv(override=True)