Skip to content

Instantly share code, notes, and snippets.

View z-ai-lab's full-sized avatar
:octocat:

z z-ai-lab

:octocat:
View GitHub Profile

Here is how to set up and run the LiteLLM Proxy with Apple Foundation Models using uv.

1. Initialize the Project

Run these commands in your terminal to create a dedicated environment and install the necessary dependencies:

# Create a new project directory
mkdir my-apple-proxy && cd my-apple-proxy
import re
def camel_to_snake(input_string):
"""
Convert camelCase or PascalCase strings to snake_case.
Args:
input_string (str): The input string in camelCase or PascalCase
@z-ai-lab
z-ai-lab / unnamed.md
Created August 21, 2025 23:34
duckdb

⚫◗

@z-ai-lab
z-ai-lab / redshift_custom.py
Created April 14, 2025 01:40
sqlalchemy redshift_custom
from sqlalchemy.dialects import registry
from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2
class RedshiftPostgresDialect(PGDialect_psycopg2):
def _set_backslash_escapes(self, connection):
self._backslash_escapes = "off"
registry.register("redshift_custom", __name__, "RedshiftPostgresDialect")
from sqlalchemy import create_engine
db = create_engine("redshift_custom://user:password@redshifthost:5439/dev")

duckdb -cmd "CREATE VIEW view_name AS FROM 'filename.csv';" -ui

@z-ai-lab
z-ai-lab / prompt-boost.yaml
Last active April 22, 2025 16:13
prompt-collections
system: |
You are a professional prompt engineer. Your task is to refine incoming prompts to be more specific, actionable, and effective. For valid prompts, follow these guidelines:
- Clarify and make instructions unambiguous.
- Add relevant context or constraints where appropriate.
- Eliminate redundancy while preserving the core intent.
- Ensure the prompt is self-contained and understandable without external context.
- Use precise, professional language.
- Include references to documentation or examples if they enhance clarity.
#!/opt/miniconda3/bin/python
import duckdb
import glob
import sys
import logging
from pathlib import Path
from typing import Optional, Union
import re
# Configure logging
import json
import networkx as nx
from collections import defaultdict
from typing import Dict, Set, List
def export_schema_to_arrows(G: nx.DiGraph) -> str:
"""
Export the schema of a NetworkX DiGraph to Arrows.app JSON format.
Schema includes unique node labels and relationship types with their connections.