Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / Earth Mover's Distance.ipynb
Created April 7, 2019 02:08
Faster 1d Earth Mover's Distance with numpy and numba.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / 3840x2160.png
Last active November 28, 2019 22:04
Schlieren Moire Pattern
3840x2160.png
@kylemcdonald
kylemcdonald / ssl-mac.md
Last active January 22, 2021 06:16
Set up SSL server on Mac.

Update: Use mkcert instead

Based on this tutorial.

First set your location:

export COUNTRY="US"
export STATE="California"
export CITY="Los Angeles"
@kylemcdonald
kylemcdonald / stylegan.ipynb
Created February 5, 2019 16:57
StyleGAN.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / heaven.ipynb
Created February 2, 2019 17:55
Heaven.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / Camera2d.h
Created January 30, 2019 22:47
2D Zoomable Region for openFrameworks. Scroll to zoom. Left click and drag to translate.
class Camera2d : public ofCamera {
private:
ofVec2f mouseStart;
ofVec2f startPosition;
float zoom;
float maxZoom = .01;
float minZoom = 1;
float zoomSpeed = 1. / 500;
public:
void setup() {
@kylemcdonald
kylemcdonald / ZoomableRegion2D.h
Created January 30, 2019 22:27
2D Zoomable Region for openFrameworks. Right click and drag to zoom. Left click and drag to translate.
#pragma once
#include "ofMain.h"
class ZoomableRegion2D {
private:
float speed = 5;
float zoom = 1;
ofVec2f offset, startOffset, startDrag;
float startZoom;
@kylemcdonald
kylemcdonald / main.cpp
Last active January 27, 2019 16:58
Example of loading an obj file with ofxAssimpModelLoader.h and rendering with just ofMesh and ofTexture.
#include "ofMain.h"
#include "ofxAssimpModelLoader.h"
class ofApp : public ofBaseApp {
public:
ofxAssimpModelLoader loader;
ofMesh mesh;
ofTexture tex;
@kylemcdonald
kylemcdonald / CUDA Argmax Comparison.ipynb
Created January 8, 2019 04:57
argmax with CUDA in cupy vs pytorch vs tensorflow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylemcdonald
kylemcdonald / auction.py
Created December 24, 2018 10:35
Auction algorithm using numba.
from numba import jit
import numpy as np
index_dtype = np.int32
cost_dtype = np.int32
@jit(nopython=True)
def auction(a, eps=1):
n = len(a)
p = np.zeros(n, dtype=cost_dtype)