Skip to content

Instantly share code, notes, and snippets.

View carsongee's full-sized avatar

Carson Gee carsongee

View GitHub Profile
#!/usr/bin/env python3
"""
Demo script for LLM Gateway Catalog SDK functionality.
This demonstrates how to use the new LLMGatewayCatalog classes to replace
manual API calls with proper SDK methods.
"""
from __future__ import annotations
from datarobot.models.genai.llm_gateway_catalog import LLMGatewayCatalog
@carsongee
carsongee / catalog_intersection.py
Created September 11, 2025 21:05
Finds all <ENV>_DATAROBOT_ENDPOINT variables from a .env file and hits the catalog to find all models and identify ones that match
#!/usr/bin/env uv run
# /// script
# dependencies = [
# "httpx",
# "python-dotenv",
# ]
# ///
"""
Script to find the intersection of models available across all DataRobot endpoints.
Usage: ./catalog_intersection.py
@carsongee
carsongee / harness_url_parser.py
Created January 24, 2024 01:40
Harness URL Parser snippet
from typing import NamedTuple
from urllib.parse import urlparse
class HarnessPipeline(NamedTuple):
account: str
org: str
project: str
pipeline: str
@classmethod
@carsongee
carsongee / t.py
Last active December 10, 2020 23:59
Quick & dirty python timer for copy/paste perf. Handy for quick measurements of functions with the decorator or blocks with the context manager
from contextlib import contextmanager
from functools import wraps
from time import perf_counter
@contextmanager
def t(name: str):
start = perf_counter()
yield
print(f'TIMER {name}: {perf_counter() - start}')
@carsongee
carsongee / github_org_stats.py
Last active May 16, 2024 18:57
Grab Contributor Statistics for a Given GitHub Organization
#!/usr/bin/env python
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
@carsongee
carsongee / mitx-stack-server-vars.yml
Created August 17, 2015 17:20
MITx stack server vars
edx_platform_repo: "https://github.com/mitocw/edx-platform.git"
edx_platform_version: "mitx-release"
edxapp_use_custom_theme: true
edxapp_theme_name: mitx
edxapp_theme_source_repo: 'https://{{ COMMON_GIT_MIRROR }}/mitocw/edx-theme.git'
edxapp_theme_version: 'mitx-loloadx'
EDXAPP_MKTG_URL_LINK_MAP:
CONTACT: !!null
FAQ: !!null
HONOR: !!null
@carsongee
carsongee / in_vs_for.py
Last active August 29, 2015 14:24
Python For loop vs in
def x_in_loop():
x = range(500)
for i in x:
if x == 253:
return True
return False
def x_in_range():
x = range(500)
return 253 in x
@carsongee
carsongee / update_libc.yml
Last active August 29, 2015 14:14
ansible play to update libc6 for GHOST and reboot serially. works for rhel and debian based distros
- name: Update libc6 and reboot
hosts: all
sudo: yes
# Comment out to apply to all servers
serial: 1
tasks:
- name: "Install packages and update cache"
apt: name="{{ item }}" state=latest update_cache=yes
with_items:
@carsongee
carsongee / course_git_backup.sh
Created January 20, 2015 14:50
course backup to git script for edx-platform
#!/bin/bash
# This script assumes that the git repository is already cloned
# App specifics
EDXAPP_USER="edxapp"
EDXAPP_VENV="/edx/app/edxapp/venvs/edxapp"
EDXAPP_DIR="/edx/app/edxapp/edx-platform"
# Git specifics
export GIT_KEY="/edx/app/course_git_backup/git_backup_deploy"
@carsongee
carsongee / tail_jenkins.py
Last active February 15, 2021 14:04
Tail Jenkins Jobs
#!/usr/bin/env python
"""
Tail a Jenkins build in a terminal
"""
import os
import requests
import sys
import time