Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / parse-heatmap.py
Created November 7, 2023 20:52
Parse the ADSBX heatmap files.
View parse-heatmap.py
import numpy as np
import datetime
def point_to_str(point):
hex = format(point & 0xFFFFFF, "06x")
hex = ("~" + hex) if (point & 0x1000000) else hex
return hex
@kylemcdonald
kylemcdonald / download-heatmaps.py
Created November 6, 2023 22:26
Download ADSB Exchange data from the heatmap endpoint.
View download-heatmaps.py
import argparse
import datetime
import urllib3
import os
from ratelimit import limits, sleep_and_retry
from tqdm import tqdm
import random
import time
domain = "globe.adsbexchange.com"
@kylemcdonald
kylemcdonald / Process and upload captions.ipynb
Created October 12, 2023 19:43
Script for converting Google Spreadsheet to Vimeo captions and uploading them automatically.
View Process and upload captions.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / fluxus.ipynb
Created October 12, 2023 00:34
Charting the lives of Fluxus members.
View fluxus.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / pyaudio-test.py
Created October 11, 2023 09:27
Show microphone level in realtime using pyaudio.
View pyaudio-test.py
import pyaudio
import audioop
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16,
channels=1,
rate=44100,
input=True,
frames_per_buffer=1024)
@kylemcdonald
kylemcdonald / daily-repeat.py
Created October 5, 2023 08:58
Daily.co app for repeating what someone has said when they say "repeat".
View daily-repeat.py
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".
View twilio-repeat.js
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 / adsbx.py
Created August 26, 2023 08:09
Download historical data from ADS-B Exchange.
View adsbx.py
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 / watch-page.sh
Created July 26, 2023 01:33
Watch a URL for updates and pop up a notification if it changes.
View watch-page.sh
#!/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 / scrape-latimes-killings.py
Last active June 21, 2023 21:33
Scrape LA Times officer-involved homicides.
View scrape-latimes-killings.py
import pandas as pd
from tqdm import tqdm
from bs4 import BeautifulSoup
import json
import requests
from itertools import count
from joblib import Parallel, delayed
metadata = []