Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / function-calling.ipynb
Created June 14, 2023 01:10
Example of OpenAI function calling API to extract data from LAPD newsroom articles.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / build-caffe.md
Last active March 26, 2024 05:52
How to build Caffe for OS X.

Theory of Building Caffe on OS X

Introduction

Our goal is to run python -c "import caffe" without crashing. For anyone who doesn't spend most of their time with build systems, getting to this point can be extremely difficult on OS X. Instead of providing a list of steps to follow, I'll try to explain why each step happens.

This page has OS X specific install instructions.

I assume:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / _tsne.pdf
Last active February 22, 2024 22:13
Exploring antonyms with word2vec.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / split-transients.py
Created December 15, 2015 05:50
Split an audio file into multiple files based on detected onsets from librosa.
#!/usr/bin/env python
import argparse
import matplotlib.pyplot as plt
import librosa
import numpy as np
import os
from progressbar import ProgressBar
parser = argparse.ArgumentParser(
@kylemcdonald
kylemcdonald / pyaudio-test.py
Created October 11, 2023 09:27
Show microphone level in realtime using pyaudio.
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 / post-server.py
Created September 21, 2014 01:24
Python POST simple server
import SimpleHTTPServer
import SocketServer
PORT = 8000
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
content_len = int(self.headers.getheader('content-length', 0))
post_body = self.rfile.read(content_len)
@kylemcdonald
kylemcdonald / matplotlib Border Removal.ipynb
Last active January 29, 2024 18:35
How to (mostly) remove all borders and padding with matplotlib.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / parse-heatmap.py
Last active January 21, 2024 08:05
Parse the ADSBX heatmap files.
import numpy as np
import datetime
import re
from dataclasses import dataclass
def point_to_str(point):
hex = f"{point & 0xFFFFFF:06x}"
hex = ("~" + hex) if (point & 0x1000000) else hex
return hex
@kylemcdonald
kylemcdonald / Line Segment Intersection.ipynb
Created July 2, 2019 18:49
Python Line Segment Intersection example.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.