Skip to content

Instantly share code, notes, and snippets.

View jcowles's full-sized avatar

Jeremy Cowles jcowles

View GitHub Profile
@jcowles
jcowles / convolutional_wasserstein.py
Last active May 13, 2021 19:21
Convolutional Wasserstein Distance & Barycenter implementation in PyTorch
# CC0, 2021 Jeremy Cowles, no rights reserved.
#
# The following is a 1-dimensional implementation of two core algorithms from the paper
#
# Convolutional Wasserstein Distances: Efficient Optimal Transportation on Geometric Domains
# https://people.csail.mit.edu/jsolomon/assets/convolutional_w2.compressed.pdf
#
import torch
@jcowles
jcowles / .vimrc
Last active August 29, 2020 17:52
My default settings to modernize Vim behavior
" On Linux/OSX this is ~/.vimrc
" On windows this is ~/_vimrc
" Don't drop garbage files everywhere.
" Note that this disables vim backup files, which I'm cool with, but
" maybe you're not.
:set nobackup
" Prepend (^=) the windows temp dir as the place to keep swap files.
" The // tells vim to use the absolute path to avoid collisions.
@jcowles
jcowles / MachineLearningResources.md
Last active November 9, 2023 09:56
Machine learning resources

"AI is the new Electricity"

Andrew Ng lecture, Stanford Graduate School of Business
High level, but totally worth watching.
https://www.youtube.com/watch?v=21EiKfQYZXc

Stanford cs231n, winter 2016

I went looking for lectures from different sources and these are a great "from first principles" introduction. The newer cs231n lectures may have more relevant details, but I like Andrej Karpathy's

@jcowles
jcowles / Object.cpp
Created February 7, 2017 16:48
Pimpl with nested forward declaration
#include "Object.h"
// Define Foo.
struct Object::Foo {
int x;
// Methods can live with data, no namespace required.
void DoStuff() {
}
@jcowles
jcowles / FullScreenQuad.shader
Last active January 23, 2023 03:58
Make a standard Unity Quad full-screen, purely in the shader
//
// 1. Add a Quad in Unity
// 2. Parent the quad under camera, to prevent frustum culling.
// 3. Attach this shader.
//
Shader "Quad/Fullscreen"
{
Properties
{
}
#define __forceinline inline
#include <iostream>
#include <embree2/rtcore.h>
#include <embree2/rtcore_ray.h>
// yuck. Required by Embree.
#include <xmmintrin.h>
#include <pmmintrin.h>