Skip to content

Instantly share code, notes, and snippets.


Kyle McDonald kylemcdonald

View GitHub Profile
kylemcdonald /
Created May 9, 2023 04:57
Accumulate LAPD roster totals by division, rank, etc.
import pandas as pd
from utils.list_files import list_files
mapping = {
'name': 'name',
'employeename': 'name',
'first name': 'first name',
'firstname': 'first name',
'last name': 'last name',
'lastname': 'last name',
View lapd-videos.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 8 columns, instead of 5. in line 4.
video name,name,duration,link,thumbnail,created_time,modified_time,release_time
Edwin Romero - LAPD Graduation,Edwin Romero,9,,,2023-04-25T14:34:12+00:00,2023-05-07T21:22:00+00:00,2023-04-25T14:34:12+00:00
Luciana Stearns - LAPD Graduation,Luciana Stearns,114,,,2023-01-04T16:54:41+00:00,2023-05-07T21:41:04+00:00,2023-01-04T16:54:41+00:00
Ramiro Zuniga - LAPD Graduation,Ramiro Zuniga,117,,,2023-01-04T16:56:17+00:00,2023-05-07T21:40:57+00:00,2023-01-04T16:56:17+00:00
Herrera Ortega Lucio- LAPD Graduation,Herrera Ortega Lucio,167,,https://i.vimeoc
kylemcdonald /
Created January 17, 2023 08:51
Python script for downloading public CPRA documents.
import requests
import json
from itertools import count
import os
import sys
import urllib3
from multiprocessing.dummy import Pool
from tqdm import tqdm
from ratelimit import limits, sleep_and_retry
kylemcdonald /
Last active December 21, 2022 23:56
Tumbleword guidance.
For Tumbleword by Jer Thorp
from collections import defaultdict
from time import time
import random
start_word = 'charade'
kylemcdonald / Audio Normalizer.ipynb
Created November 16, 2022 07:59
Normalize audio based on local peaks.
View Audio Normalizer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kylemcdonald /
Created May 15, 2022 07:58
Split an audio file into multiple files given a list of timestamps exported from out of an Ableton set.
import subprocess
track_fn = 'audio.wav'
timestamps_fn = 'timestamps.csv'
with open(timestamps_fn) as f:
lines =
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 /
Last active March 13, 2023 21:46
Python vs Node web3 speed comparison.
#!/bin/bash -x
node get_block_speed_sync_ipc.js
node get_block_speed_async_ipc.js
kylemcdonald /
Created September 14, 2021 04:26
Setting up a Digital Ocean droplet for node.js

Get the $IP from Digital Ocean and use the same $USERNAME as your main computer.

ssh root@$IP
adduser $USERNAME
usermod -aG sudo $USERNAME
ufw allow OpenSSH
ufw enable
rsync --archive --chown=$USERNAME:$USERNAME ~/.ssh /home/$USERNAME
kylemcdonald / long_run_gray_codes.frag
Last active June 4, 2023 11:16
Long Run Gray Codes for 2-bits through 13-bits.
View long_run_gray_codes.frag
// Generated using code from
// More info on LRGC
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 / Search SMAT Data.ipynb
Created February 9, 2021 23:09
Build plots of term frequency on Parler using SMAT data collected by Aliapoulios, et al.
View Search SMAT Data.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.