Skip to content

Instantly share code, notes, and snippets.

View yirenlu92's full-sized avatar

Ren yirenlu92

View GitHub Profile
<html lang="en"><head>&#10;<meta name="sentry-trace" content="d4b6b1fcbec526f6f3aff9335394403d-3bf62997116d3bae">&#10;<meta name="baggage" content="sentry-environment=production,sentry-public_key=d75f7cb747cd4fe8ac03973ae3d39fec,sentry-trace_id=d4b6b1fcbec526f6f3aff9335394403d">&#10;<script>
const f = window.fetch;
if(f){
window._sentryFetchProxy = function(...a){return f(...a)}
window.fetch = function(...a){return window._sentryFetchProxy(...a)}
}
</script>&#10; <meta charset="utf-8">&#10; <meta name="viewport" content="width=device-width, initial-scale=1">&#10; <meta name="format-detection" content="telephone=no">&#10;&#10; <link rel="icon" href="https://modal.com/assets/favicon.ico" sizes="any">&#10; <link rel="icon" href="https://modal.com/assets/favicon.svg" type="image/svg+xml">&#10; <link rel="stylesheet" href="https://use.typekit.net/jcd8ppx.css">&#10;&#10; <meta http-equiv="content-security-policy" content="frame-src embed.fillout.com player.vimeo.com www.
<!doctype html>
<html lang="en">
<head>
<meta name="sentry-trace" content="184e1175228e91ef19473c47ea93b5a2-313c6f856f8a9f68"/>
<meta name="baggage" content="sentry-environment=production,sentry-public_key=d75f7cb747cd4fe8ac03973ae3d39fec,sentry-trace_id=184e1175228e91ef19473c47ea93b5a2"/>
<script >
const f = window.fetch;
if(f){
window._sentryFetchProxy = function(...a){return f(...a)}
window.fetch = function(...a){return window._sentryFetchProxy(...a)}
@yirenlu92
yirenlu92 / gist:336b9b96a4145eb2bcdf8e07ba92fedf
Created April 9, 2025 18:09
running livekit agents on Modal
from modal import App, Image, Secret, fastapi_endpoint
from livekit.agents.worker import Worker, WorkerOptions
image = Image.debian_slim().pip_install(
"fastapi[standard]",
"aiohttp",
"livekit>=1.0.1",
"livekit-agents>=0.12.19",
"livekit-plugins-openai>=0.10.17",
"livekit-plugins-silero>=0.7.4",
{
"job_configuration":
{
"...": "...",
"proxy": "{{ proxy }}" # <-- leave as is to make templatable
},
"variables":
{
"properties":
{
<div style="background: linear-gradient(140deg, #1E1E2E 0%, #0F1117 100%); border: 1px solid #2E2E3E; border-radius: 16px; padding: 48px; margin: 40px 0; max-width: 800px;">
<h3 style="margin: 0 0 16px 0; color: white; font-size: 32px; font-weight: 600; line-height: 1.2;">Unified Cloud Orchestration for Kubernetes</h3>
<p style="color: #A1A1AA; font-size: 16px; line-height: 1.6; margin-bottom: 24px; max-width: 600px;">
Manage Kubernetes at scale through a single, enterprise-ready platform.
</p>
<div style="display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 32px;">
<div style="display: flex; align-items: center; gap: 8px; min-width: 200px;">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
@yirenlu92
yirenlu92 / heroicons_fine_tuning.py
Created May 21, 2024 16:29
Code for "Creating an infinite icon library" blog post
import os
import sys
from dataclasses import dataclass
from pathlib import Path
from fastapi import FastAPI
from modal import Image, App, Volume, gpu, Secret, enter, method, asgi_app
GIT_SHA = "abd922bd0c43a504e47eca2ed354c3634bd00834" # specify the commit to fetch
import openai
import json
import snowflake.connector
table_metadata = """
Table name: agents
name type kind null? default primary key unique key check expression comment policy name
AGENT_CODE VARCHAR(6) COLUMN N Y N
AGENT_NAME VARCHAR(40) COLUMN Y N N
WORKING_AREA VARCHAR(35) COLUMN Y N N
@yirenlu92
yirenlu92 / app.py
Created July 29, 2021 20:52
Flask demo
from flask import Flask, request
app = Flask(__name__)
@app.route('/basic_api/entities', methods=['GET', 'POST'])
def entities():
if request.method == "GET":
return {
'message': 'This endpoint should return a list of entities',
'method': request.method
@yirenlu92
yirenlu92 / main.py
Created July 29, 2021 20:49
Fast API CRUD Demo
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
class Entity(BaseModel):
name: str
description: Optional[str] = None
@yirenlu92
yirenlu92 / metered_forecast.md
Last active July 28, 2021 23:58
Forecasting Timeseries with Metered and Prophet

Forecasting timeseries with the Metered Prophet API

Forecasting timeseries

Forecasting timeseries is a common problem in data science/machine learning. It asks, given a set of observations of the past, what the future will look like.

Some real world applications of timeseries forecasting include:

  • Sales/demand forecasting: Say you're an ice cream chain. You might expect that sales will be much higher in the summer and lower in the winter, but trend higher year-over-year overall because you're investing in advertising. The sales forecasts would be useful for things like setting quota for your salespeople, financial disclosure/valuation, and inventory planning.
  • Capacity planning: In a software context, capacity planning refers to ensuring enough compute resources to serve expected traffic. More broadly, capacity planning asks, how many servers, employees, meals, parking spaces, etc