Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / download-stems.py
Last active January 11, 2026 10: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 / three.js.shader.html
Last active January 6, 2026 14:46
Minimal three.js shader example.
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}
@kylemcdonald
kylemcdonald / hsv2rgb.glsl
Created July 14, 2015 18:44
Every unique HSV to RGB conversion function named "hsv2rgb" on ShaderToy.
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
const vec4 K = vec4(1., 2. / 3., 1. / 3., 3.);
vec3 hsv2rgb(vec3 c)
{
// from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
@kylemcdonald
kylemcdonald / clip_and_combine.py
Created September 5, 2025 22:58
Process MP4 files: trim and concatenate using ffmpeg.
#!/usr/bin/env python3
import os
import sys
import argparse
import subprocess
import glob
from pathlib import Path
import natsort
@kylemcdonald
kylemcdonald / file_checker.py
Created September 5, 2025 22:57
This script checks if all file names from the first directory exist somewhere in the second directory, including subdirectories recursively.
#!/usr/bin/env python3
"""
File Name Checker
This script checks if all file names from the first directory exist somewhere
in the second directory, including subdirectories recursively.
"""
import os
import sys
@kylemcdonald
kylemcdonald / copy_source_files.txt
Created August 6, 2025 01:47
Python script for copying many files of interest from old hard drives.
#!/usr/bin/env python3
import os
import shutil
import argparse
from pathlib import Path
def copy_source_files(source_dir, dest_dir, extensions=('.h', '.cpp', '.pde')):
"""
Recursively find files with specified extensions and copy them to destination
@kylemcdonald
kylemcdonald / oldest-newest.py
Created August 4, 2025 21:06
Python script for showing a histogram of the file creation times of all files in a directory.
import os
import time
import matplotlib.pyplot as plt
from datetime import datetime
def format_time(epoch_time):
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch_time))
# Global figure and axis for single window
fig, ax = None, None
@kylemcdonald
kylemcdonald / long_run_gray_codes.frag
Last active August 2, 2025 09:23
Long Run Gray Codes for 2-bits through 13-bits.
// Generated using code from https://stackoverflow.com/a/66555635/940196
// More info on LRGC http://emis.impa.br/EMIS/journals/EJC/Volume_10/PDF/v10i1r27.pdf
const int lrgc_2[4] = int[](0,1,3,2);
const int lrgc_3[8] = int[](0,1,3,2,6,7,5,4);
const int lrgc_4[16] = int[](0,1,3,7,15,11,9,8,12,13,5,4,6,14,10,2);
const int lrgc_5[32] = int[](0,1,3,7,15,31,29,25,17,16,18,2,10,14,12,28,20,21,23,19,27,11,9,13,5,4,6,22,30,26,24,8);
const int lrgc_6[64] = int[](0,1,3,7,15,31,63,62,58,42,40,32,36,37,5,21,17,25,27,11,10,14,46,38,54,50,48,49,33,41,9,13,29,28,30,26,18,2,34,35,39,55,53,61,57,56,24,8,12,4,6,22,23,19,51,59,43,47,45,44,60,52,20,16);
const int lrgc_7[128] = int[](0,32,33,35,39,103,111,127,125,93,89,81,80,16,18,2,10,42,46,44,60,124,116,117,119,87,83,91,75,11,9,13,5,37,36,38,54,118,126,122,120,88,72,64,65,1,3,7,15,47,63,61,57,121,113,112,114,82,66,74,78,14,12,28,20,52,53,55,51,115,123,107,105,73,77,69,68,4,6,22,30,62,58,56,40,104,96,97,99,67,71,79,95,31,29,25,17,49,48,50,34,98,106,110,108,76,92,84,85,21,23,19,2
@kylemcdonald
kylemcdonald / Collect Parler Metadata.ipynb
Last active July 27, 2025 17:52
Collect video URLs and GPS data for Parler videos.
Loading
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.
import pyaudio
import audioop
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16,
channels=1,
rate=44100,
input=True,
frames_per_buffer=1024)