Skip to content

Instantly share code, notes, and snippets.

View yirenlu92's full-sized avatar

Ren yirenlu92

View GitHub Profile
@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
the point of gist is to act as a pastebin