Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@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 / 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / setup.sh
Last active May 24, 2021 22:12
Build OpenCV for Raspberry Pi under Ubuntu 20.10 64-bit server, aand test v4l2 camera frame rate.
CV_VERSION=4.5.1
cd ~
sudo apt update
sudo apt-get install -y \
build-essential \
cmake \
gfortran \
@kylemcdonald
kylemcdonald / make-multithumbnails.py
Created January 20, 2021 20:58
Make multithumbnails for Parler videos.
"""
This file reads a list of Parler video IDs and generates "multithumbnails" (a sequence of 9 evenly-spaced thumbnails).
The multithumbnails are stored in the multithumbnails/linear and multithumbnails/rect directories.
linear/ puts the thumbnails side-by-side in a linear sequence.
rect/ puts the thumbnails in a 3x3 rectangle.
To run, download this script from GitHub then:
git clone https://github.com/kylemcdonald/python-utils.git utils
sudo apt install python3 python3-pip
pip3 install --user --upgrade pip
pip3 install --user numpy ffmpeg-python opencv-python pillow
@kylemcdonald
kylemcdonald / generate-metadata.sh
Created January 14, 2021 03:48
Generate metadata for a folder using ffprobe.
INPUT_DIR=$1
OUTPUT_DIR=$2
mkdir -p $OUTPUT_DIR
for INPUT_FN in `find "$1" -type f`
do
BASENAME=`basename $INPUT_FN`
OUTPUT_FN=$OUTPUT_DIR/$BASENAME.json
if test -f "$OUTPUT_FN"; then
echo "skipping $INPUT_FN"
@kylemcdonald
kylemcdonald / parler-video.md
Last active July 10, 2022 04:22
How to view a video on Parler.

How to view a video on Parler

Let's say you have a video ID, like wfy02V209EwU taken from this map

The link for the video kiBnNejo0JW0 is at https://video.parler.com/ki/Bn/kiBnNejo0JW0. Notice that the link is: https://video.parler.com/ followed by the first two characters of the video ID, then /, then the next two characters, another /, and the video ID.

But if you click on this, you will get an error.

This is because the Parler video servers are still running (as of January 12) but the Domain Name System (DNS) is not running.

@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 / Keras Multitask Learning.ipynb
Created September 4, 2020 19:56
Multitask Learning in Keras with an augmented Fashion MNIST.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / search-dates.py
Last active September 8, 2020 07:28
Search for dates and times across all files in a folder.
"""
Search for dates and times in a folder.
$ python3 search-dates.py facebook-kcimc/
$ python3 search-dates.py Takeout/
"""
import os
import sys
import re
import shutil
@kylemcdonald
kylemcdonald / index.html
Last active January 25, 2023 21:33
Minimal example of uploading a webcam image to a Flask server.
<html>
<head>
<title>Webcam Upload</title>
<style>
html, body {
height: 100%;
}
* {
font-family: sans-serif;
user-select: none;