Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / daily-repeat.py
Created October 5, 2023 08:58
Daily.co app for repeating what someone has said when they say "repeat".
from google.cloud import speech
import argparse
import time
from daily import Daily, CallClient
SAMPLE_RATE = 44100
CHUNK_COUNT = 10
FRAME_COUNT = CHUNK_COUNT * SAMPLE_RATE // 100
@kylemcdonald
kylemcdonald / twilio-repeat.js
Created October 4, 2023 01:53
Twilio app for repeating everything someone has said once they say the word "repeat".
const WebSocket = require("ws");
const express = require("express");
const app = express();
const server = require("http").createServer(app);
const wss = new WebSocket.Server({ server });
const path = require("path");
const fs = require("fs");
require("dotenv").config();
@kylemcdonald
kylemcdonald / download-stems.py
Last active September 23, 2023 23:37
Download all the stems from Beatport.
from multiprocessing.dummy import Pool
from urllib3 import HTTPConnectionPool
from tqdm import tqdm
import itertools
import os
import errno
n_connections = 32
domain = 'geo-samples.beatport.com'
http_pool = HTTPConnectionPool(domain)
@kylemcdonald
kylemcdonald / Collect Parler Metadata.ipynb
Last active September 20, 2023 11:45
Collect video URLs and GPS data for Parler videos.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / adsbx.py
Created August 26, 2023 08:09
Download historical data from ADS-B Exchange.
import requests
import os
import argparse
import datetime
import time
parser = argparse.ArgumentParser(
description='Download historical data from ADS-B Exchange.')
parser.add_argument('-i', '--icao', default='icao.txt', type=str,
help='Newline delimited text file of ICAO hex codes.')
@kylemcdonald
kylemcdonald / Camera2d.h
Created January 30, 2019 22:47
2D Zoomable Region for openFrameworks. Scroll to zoom. Left click and drag to translate.
class Camera2d : public ofCamera {
private:
ofVec2f mouseStart;
ofVec2f startPosition;
float zoom;
float maxZoom = .01;
float minZoom = 1;
float zoomSpeed = 1. / 500;
public:
void setup() {
@kylemcdonald
kylemcdonald / watch-page.sh
Created July 26, 2023 01:33
Watch a URL for updates and pop up a notification if it changes.
#!/bin/bash
URL=$1
LAST_PAGE="cache.html"
while true; do
curl -s "$URL" > "$LAST_PAGE"
echo -n "$(date) - $(stat -f "%z" "$LAST_PAGE") - "
openssl md5 "$LAST_PAGE" | cut -d' ' -f2
if ! diff -q "$LAST_PAGE" "$LAST_PAGE.old" > /dev/null; then
@kylemcdonald
kylemcdonald / lease-answering.ipynb
Last active June 30, 2023 22:30
Notebook demonstrating the way that you ask GPT-3.5 a question changes the response. The function calling API performs the worst.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / split.py
Created May 15, 2022 07:58
Split an audio file into multiple files given a list of timestamps exported from timestamps.me out of an Ableton set.
import subprocess
track_fn = 'audio.wav'
timestamps_fn = 'timestamps.csv'
with open(timestamps_fn) as f:
lines = f.read().splitlines()
lines = [e.split(',')[2] for e in lines]
cmd_string = 'ffmpeg -hide_banner -loglevel error -i {tr} -acodec copy -ss {st} -to {en} {nm}'
@kylemcdonald
kylemcdonald / Adversarial Variational Bayes toy example.ipynb
Last active June 22, 2023 08:17
Adversarial Variational Bayes toy example in PyTorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.