Skip to content

Instantly share code, notes, and snippets.

View dtran320's full-sized avatar
๐ŸŒŠ
Come co-work with us virtually! https://www.flow.club

David Tran dtran320

๐ŸŒŠ
Come co-work with us virtually! https://www.flow.club
View GitHub Profile
@kwindla
kwindla / voice-agents.md
Created June 23, 2025 23:43
Advice on Voice Agents - June 2025

Advice on Voice AI, June 2025

My top three pieces of advice for people getting started with voice agents.

  1. Spend time up front understanding why latency and instruction following accuracy drive voice AI tech choices.

  2. You will need to add significant tooling complexity as you go from proof of concept to production. Prepare for that. Especially important: build lightweight evals as early as you can.

  3. The right path is: start with a proven, "best practices" tech stack -> get everything working one piece at a time -> deploy to real-world users and collect data -> then think about optimizing cost/latency/etc.

@kwindla
kwindla / talk.py
Created October 7, 2024 01:59
command-line openai realtime
import asyncio
import base64
import json
import os
import pyaudio
import shutil
import websockets
class AudioStreamer:
@karpathy
karpathy / stablediffusionwalk.py
Last active June 29, 2025 09:56
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@krasimir
krasimir / delete_artifacts.js
Last active May 25, 2024 00:30
Deleting artifacts in GCP's Cloud Storage (ignores latest and leaves at least two versions)
const spawn = require("child_process").spawn;
const KEEP_AT_LEAST = 2;
const CONTAINER_REGISTRIES = [
"gcr.io/<your project name>",
"eu.gcr.io/<your project name>/gcf/europe-west3"
];
async function go(registry) {
console.log(`> ${registry}`);
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/[email protected]"></script>
<style>
.relative {
position: relative;
}
.renderer {
width: 400px;
@seratch
seratch / Dockerfile
Last active April 2, 2025 11:15
Slack OAuth App Example (Google Cloud Run + Datastore)
# https://hub.docker.com/_/python
FROM python:3.9.2-slim-buster
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
@zanona
zanona / sentry-serverless-firebase.ts
Last active September 4, 2024 19:51
Missing Sentry's firebase serverless wrappers
/**
* Temporary wrapper for firebase functions until @sentry/serverless support is implemented
* It currently supports wrapping https, pubsub and firestore handlers.
* usage: https.onRequest(wrap((req, res) => {...}))
*/
import type {Event} from '@sentry/types';
import type {https} from 'firebase-functions';
import type {onRequest, onCall} from 'firebase-functions/lib/providers/https';
import type {ScheduleBuilder} from 'firebase-functions/lib/providers/pubsub';
import type {DocumentBuilder} from 'firebase-functions/lib/providers/firestore';
@kwindla
kwindla / frame-reduced-cpu.html
Created February 1, 2021 04:50
Daily video API: reduced resolution camera settings for lower cpu usage
<html>
<head>
<title>reduced cpu camera setting</title>
<script src="https://unpkg.com/@daily-co/daily-js"></script>
</head>
<body onload="main()">
<script>
// change ROOM_URL to a room in your Daily domain
const ROOM_URL = "https:// A ROOM URL";
@JamieCurnow
JamieCurnow / firestore.ts
Last active May 19, 2025 08:11
Using Firestore with Typescript
/**
* This Gist is part of a medium article - read here:
* https://jamiecurnow.medium.com/using-firestore-with-typescript-65bd2a602945
*/
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Import or define your types
// import { YourType } from '~/@types'
@th3m477
th3m477 / Web3Connection.js
Last active June 13, 2019 21:20
Web3.js websocket connection logic
const RECONNECT_MILLIS = 2000
class Web3Connection {
constructor() {
this.connect()
}
async connect() {
const provider = new Web3.providers.WebsocketProvider('...')