Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle McDonald kylemcdonald

View GitHub Profile
View two-chords.md

At 0:37 into this track generated by a machine learning algorithm, there are two high-pitched bell-like very jazzy chords that arpeggiate from the higher to the lower notes.

The rest of the track is Cm, and my best guess for these chords is:

  1. Db Eb F Ab Bb (Db69)
  2. Eb F G Bb (Ebadd9)
@kylemcdonald
kylemcdonald / ripple.ipynb
Last active Mar 2, 2020
Ripple tank simulations in PyTorch based on https://github.com/jsbarbosa/rippleTank
View ripple.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / youtube-batch-search.py
Created Jan 18, 2020
Search YouTube for results using a newline separated list of queries.
View youtube-batch-search.py
import json
import googleapiclient.discovery
query_fn = 'queries.txt'
api_key = '' # insert API key here
# https://developers.google.com/youtube/v3/docs/search/list
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 (https://keybase.io/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
kylemcdonald / a2-collections.py
Last active Oct 14, 2019
List a2p collections.
View a2-collections.py
from urllib.request import urlopen
import json
from multiprocessing import Pool
traders = json.load(urlopen('https://a2p.bitmark.com/s/api/traders'))
id_to_alias = {}
tasks = []
for trader in traders['traders']:
id = trader['id']
id_to_alias[id] = trader['alias']
@kylemcdonald
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
kylemcdonald / threaded-worker.py
Created Aug 29, 2019
Example of multithreaded/multiprocess workers in Python.
View threaded-worker.py
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
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
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
kylemcdonald / mueller-gpt-2.md
Created Apr 19, 2019
GPT-2 completions for Mueller report
View mueller-gpt-2.md

Seed

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.

Output

  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