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 / function-calling.ipynb
Created June 14, 2023 01:10
Example of OpenAI function calling API to extract data from LAPD newsroom articles.
View function-calling.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View photomosaic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / youtube-batch-search.py
Created January 18, 2020 02:13
Search YouTube for results using a newline separated list of queries.
View youtube-batch-search.py
import json
import googleapiclient.discovery
query_fn = 'queries.txt'
api_key = '' # insert API key here
# https://developers.google.com/youtube/v3/docs/search/list
params = {
'videoDuration': 'short', # any long medium short
'videoDefinition': 'any', # high standard
'order': 'viewCount', # date rating relevance title viewCount
@kylemcdonald
kylemcdonald / matplotlib Border Removal.ipynb
Last active October 13, 2023 16:14
How to (mostly) remove all borders and padding with matplotlib.
View matplotlib Border Removal.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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