Skip to content

Instantly share code, notes, and snippets.

View setuc's full-sized avatar

Setu Chokshi setuc

View GitHub Profile
@setuc
setuc / grader.ts
Created March 11, 2025 15:20 — forked from av/grader.ts
grader-script
import openai from "openai";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
import fs from "fs";
import path from "path";
import intros from "./intros.json";
const config = {
@setuc
setuc / intros.json
Created March 11, 2025 15:20 — forked from av/intros.json
intros
{
"head": {
"prompts": [
{
"raw": "Write one concise paragraph about the company that created you",
"label": "{{subject}}",
"provider": "meta-llama/llama-3.3-70b-instruct",
"metrics": {
"score": 5,
"testPassCount": 5,
@setuc
setuc / converter.py
Created March 11, 2025 12:26
This Python script recursively converts Jupyter Notebook files (.ipynb) to Python scripts (.py) (and vice versa, if desired). It preserves the directory structure and can dynamically choose an output directory—falling back to a subfolder when working in environments such as GitHub Codespaces. Additionally, by default, it zips the output folder …
import argparse
import os
import nbformat
from nbconvert import PythonExporter
import logging
from rich.console import Console
from rich.table import Table
from rich.logging import RichHandler
import zipfile
@setuc
setuc / README.md
Created October 16, 2024 08:26
Azure OpenAI Quota Checker: A Bash script that automates the process of checking Azure OpenAI model quota availability across your preferred regions. Easily identify the optimal region for deploying your resources based on quota availability for models like GPT-4, GPT-3.5-Turbo, and more. Customize the script to fit your needs and streamline you…

Azure OpenAI Quota Checker

Problem Statement

When deploying Azure OpenAI services, one of the key challenges is determining which regions have available quotas for the specific models you intend to use. Azure imposes quotas on OpenAI models, and these quotas can vary widely between regions and models. Manually checking each region for quota availability is not only time-consuming but also inefficient.

This script solves that problem by:

  • Automating Quota Checks: It programmatically checks the quota availability for specified Azure OpenAI models across your preferred regions.
  • Providing Clear Output: Generates a formatted table displaying the availability status, making it easy to interpret the results.
@setuc
setuc / AzureRunbook.ps1
Last active October 7, 2024 10:34
# Azure Storage Account Key Access Manager This Bash script provides an interactive way to manage the "Allow storage account key access" setting for Azure Storage Accounts.
# Connect to Azure with system-assigned managed identity as you will be able to define permissions at a RG / Sub level. Easier to manage
Connect-AzAccount -Identity
# Get all storage accounts
$storageAccounts = Get-AzStorageAccount
@setuc
setuc / gradient_generator.py
Created February 20, 2024 04:30
A Python script that generates and displays color gradients using matplotlib. It includes functions to convert HEX color codes to RGB, interpolate between two colors, and generate a visual representation of the color gradient.
#!/usr/bin/env python
# coding: utf-8
# This script demonstrates generating gradients between two specified colors.
# Users can define their start and end colors in HEX format, and the script will display the gradient transition.
# Requirements: numpy, matplotlib
import numpy as np
import matplotlib.pyplot as plt
def hex_to_rgb(hex_color):
"""
@setuc
setuc / read_sql
Created November 23, 2021 04:50
Read write to Azure SQL database from pandas
"""
Read write to Azure SQL database from pandas
Reference: mkempers sql pandas
"""
import pyodbc
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
# 1. Constants
0xaFBE002fa7c65b9C01e9e139E541d4cA18e09096
@setuc
setuc / __init__.py
Created March 30, 2020 08:58
Azure Functions replacement __init__ for custom vision
import logging
import json
import azure.functions as func
from .predict import predict_url, log_msg
def main(req: func.HttpRequest) -> func.HttpResponse:
image_url = req.params.get('img')
logging.info('Image URL received: ' + image_url)
results = predict_url(image_url)