Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / Search SMAT Data.ipynb
Created Feb 9, 2021
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.
@kylemcdonald
kylemcdonald / setup.sh
Last active May 24, 2021
Build OpenCV for Raspberry Pi under Ubuntu 20.10 64-bit server, aand test v4l2 camera frame rate.
View setup.sh
CV_VERSION=4.5.1
cd ~
sudo apt update
sudo apt-get install -y \
build-essential \
cmake \
gfortran \
@kylemcdonald
kylemcdonald / make-multithumbnails.py
Created Jan 20, 2021
Make multithumbnails for Parler videos.
View make-multithumbnails.py
"""
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 Jan 14, 2021
Generate metadata for a folder using ffprobe.
View generate-metadata.sh
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 May 19, 2021
How to view a video on Parler.
View parler-video.md

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 May 3, 2021
Collect video URLs and GPS data for Parler videos.
View Collect Parler Metadata.ipynb
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 Sep 4, 2020
Multitask Learning in Keras with an augmented Fashion MNIST.
View Keras Multitask Learning.ipynb
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 Sep 8, 2020
Search for dates and times across all files in a folder.
View search-dates.py
"""
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 May 22, 2020
Minimal example of uploading a webcam image to a Flask server.
View index.html
<html>
<head>
<title>Webcam Upload</title>
<style>
html, body {
height: 100%;
}
* {
font-family: sans-serif;
user-select: none;
@kylemcdonald
kylemcdonald / capture_fast.cpp
Last active May 21, 2020
Try to capture from arducam on RPI as fast as possible.
View capture_fast.cpp
#include "arducam_mipicamera.h"
#include <linux/v4l2-controls.h>
#include <stdio.h>
#include <sys/time.h>
void capture_image(CAMERA_INSTANCE camera_instance) {
IMAGE_FORMAT fmt = {IMAGE_ENCODING_RAW_BAYER, 0};
BUFFER *buffer = arducam_capture(camera_instance, &fmt, 6000);
arducam_release_buffer(buffer);
}