Skip to content

Instantly share code, notes, and snippets.

Daniel Kohlsdorf dkohlsdorf

View GitHub Profile
@dkohlsdorf
dkohlsdorf / alignment_dtw.py
Last active Mar 19, 2019
Align A Bunch Of Videos. Second file using merge sort for joining the timestamps.
View alignment_dtw.py
'''
Align videos using Dynamic Time Warping
Given a set of video files with associated time stamp files,
the program creates a new set of aligned videos.
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@dkohlsdorf
dkohlsdorf / avro_tcp_ip.rs
Last active Mar 14, 2019
Avro over TCP / Ip in Rust
View avro_tcp_ip.rs
extern crate avro_rs;
use avro_rs::*;
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
use std::thread;
#[derive(Debug, Deserialize, Serialize)]
pub struct Test {
@dkohlsdorf
dkohlsdorf / download_toronto.py
Last active Sep 1, 2018
Download Toronto Emotion Speech Set
View download_toronto.py
from lxml import html
import requests
import urllib.request
import re
import time
import os.path
HANDLE = '^/handle/[0-9]+/[0-9]+$'
BASE_URL = 'https://tspace.library.utoronto.ca'
page = requests.get(BASE_URL + '/handle/1807/24487')
@dkohlsdorf
dkohlsdorf / iSax.py
Created Aug 16, 2018
Simple iSAX Implementation
View iSax.py
import numpy as np
import scipy.stats as stats
def generate_split(n_char, mu = 0.0, std = 1.0):
return stats.norm.ppf(np.arange(1, n_char) / n_char, mu, std)
def convert(x, splits, cardinality):
n = len(x)
chars = np.zeros(n, dtype=np.int)
for i in range(0, n):
@dkohlsdorf
dkohlsdorf / UnionFind.java
Created Jun 27, 2018
Union Find Data Structure
View UnionFind.java
public class UnionFind {
private int id[];
private int count;
public UnionFind(int N) {
count = N;
id = new int[N];
for(int i = 0; i < N; i++) {
View InfiniteCalm.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dkohlsdorf
dkohlsdorf / nips.py
Last active May 23, 2018
Download all nips papers ever
View nips.py
from lxml import html
import requests
import urllib.request
BASE_URL = 'https://papers.nips.cc/'
page = requests.get(BASE_URL)
tree = html.fromstring(page.content)
books = [ href.attrib['href'] for href in tree.xpath('//a') if 'book' in href.attrib['href']]
@dkohlsdorf
dkohlsdorf / Alignment.scala
Last active May 26, 2017
General Sequence Alignment
View Alignment.scala
class Alignment[A](
init: (Int, Int) => Double,
rank: (Double, Double, Double, A, A) => Double
) {
def score(x: Array[A], y: Array[A]): Double = {
val n = x.size
val m = y.size
val dp = Array.ofDim[Double](n + 1, m + 1)
View Merko.txt
,~~+++===~:,,,,
,,:=+==~~~=~========::,
,:++?=~::~~~~~~~~~~=~====:,
,::=?+=~~~~~~~~::::::::~~~~~~~~==~:
,,:=?+?=~~~~~:~~~~~~::::::::::::::~====~:,
:++???=~~~::::~:~~~::,,,,,,,,,:::,::::~~=++~,
,~+++===~~:::::::::::,,,,,,,,,,,,,,,,:::~~==?=,
, ,+?+==~~::::::::::,,,,,,,..........,,,,,,~~~==?=,
=~?+???=~::::::,,,,,,,,,,,,..............,,~~=+??+=:
+++=+====~:::::,,,,,,,,,,,,,...............,,,,~++===+:
@dkohlsdorf
dkohlsdorf / SparseVector
Last active Mar 18, 2019
Interview Question Sparse Vector
View SparseVector
//Given two sparse vectors. Write a function to find a dot product of these vectors.
// [0,4,0,0,1,0,0,10,0]
// [2,0,0,0,3,0,0,0,0]
// 3
x = (4, 1), (1, 4), (10, 7)
y = (2, 0), (3, 4)
You can’t perform that action at this time.