Skip to content

Instantly share code, notes, and snippets.

Kyle McDonald kylemcdonald

Block or report user

Report or block kylemcdonald

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kylemcdonald /
Created Jan 18, 2020
Search YouTube for results using a newline separated list of queries.
import json
import googleapiclient.discovery
query_fn = 'queries.txt'
api_key = '' # insert API key here
params = {
'videoDuration': 'short', # any long medium short
'videoDefinition': 'any', # high standard
'order': 'viewCount', # date rating relevance title viewCount
View keybase.txt
### Keybase proof
I hereby claim:
* I am kylemcdonald on github.
* I am kylemcdonald ( on keybase.
* I have a public key whose fingerprint is AAD2 D2E7 28AF 5533 86B6 3209 8F40 5F0E D0DE 80FF
To claim this, I am signing this object:
kylemcdonald /
Last active Oct 14, 2019
List a2p collections.
from urllib.request import urlopen
import json
from multiprocessing import Pool
traders = json.load(urlopen(''))
id_to_alias = {}
tasks = []
for trader in traders['traders']:
id = trader['id']
id_to_alias[id] = trader['alias']
kylemcdonald / Interprocess Queue Performance.ipynb
Created Sep 8, 2019
Testing the performance of Queue-based IPC in Python 3.7.
View Interprocess Queue Performance.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kylemcdonald /
Created Aug 29, 2019
Example of multithreaded/multiprocess workers in Python.
from multiprocessing import Process as WorkerType
# uncomment this line to try multithreading instead
# from threading import Thread as WorkerType
from multiprocessing import Queue
from time import sleep
def job_loop(id, q):
print(id, 'ready')
kylemcdonald / Line Segment Intersection.ipynb
Created Jul 2, 2019
Python Line Segment Intersection example.
View Line Segment Intersection.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kylemcdonald / getUserMedia-setup.js
Last active May 30, 2019
Some things that can go wrong when setting up a camera with getUserMedia.
View getUserMedia-setup.js
function cameraReady(videoElement) {
console.log('cameraReady: checking...');
if (videoElement) {
if (videoElement.srcObject) {
let tracks = videoElement.srcObject.getVideoTracks();
if (tracks.length > 0) {
if (tracks[0].readyState == 'live') {
let w = videoElement.videoWidth, h = videoElement.videoHeight;
if (w > 0 || h > 0) {
console.log('cameraReady: live! ' + w + 'x' + h);
kylemcdonald /
Created Apr 19, 2019
GPT-2 completions for Mueller report


In a later November 2018 interview, Corsi stated that he thought that he had told people on a WND conference call about the forthcoming tape and had sent out a tweet asking whether anyone could contact Assange, but then said that maybe he had done nothing. The Office investigated Corsi's allegations about the events of October 7, 2016 but found little corroboration for his allegations about the day. However, the phone records themselves do not indicate that the conversation was with any of the reporters who broke the Access Hollywood story, and the Office has not otherwise been able to identify the substance of the conversation.


  1. According to a transcript of the October 7, 2016 interview posted on Wikileaks, Corsi said that he did talk about "the sexual assault case" that had emerged in the wake of Trump's election...
  2. The story also has new details about the relationship between WikiLeaks founder Julian Assange and the media. In a public statement, the WikiLeaks founder said that he ha
kylemcdonald / centerText.js
Created Apr 16, 2019
Draw centered text on a canvas, maximally filling a given maxWidth/maxHeight.
View centerText.js
function centerText(text, canvas, config) {
var ctx = canvas.getContext('2d');
var x = config.x;
var y = config.y;
var maxWidth = config.maxWidth || canvas.width;
var maxHeight = config.maxHeight || canvas.height;
var lineHeight = config.lineHeight || 1.2;
var fontFamily = config.fontFamily || 'sans-serif';;
var lines = text.split('\n');
kylemcdonald / tileText.js
Created Apr 16, 2019
Tile text across a canvas.
View tileText.js
function tileText(text, canvas, config) {
var fontSize = config.fontSize || 20;
var lineHeight = config.lineHeight || 1.2;
var fontFamily = config.fontFamily || 'sans-serif';
var pad = config.padding || fontSize;
var lineHeightPx = lineHeight * fontSize;
if (config.lineSnap) {
var textRows = Math.floor(canvas.height / lineHeightPx);
lineHeightPx = canvas.height / textRows;
You can’t perform that action at this time.