Skip to content

Instantly share code, notes, and snippets.

View erdmann's full-sized avatar

Rob Erdmann erdmann

  • Rijksmuseum, University of Amsterdam
  • Amsterdam
  • X @erdmann
View GitHub Profile
@adtac
adtac / Dockerfile
Last active May 28, 2024 01:38
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@norabelrose
norabelrose / r-nn-svd.py
Last active January 2, 2023 08:34
Relaxed non-negative SVD
import torch as th
import torch.nn.functional as F
# Sinkhorn-Knopp algorithm for projecting onto doubly stochastic matrices
def sinkhorn_knopp(A: th.Tensor, max_iter: int = 20):
A = A.clone()
for _ in range(max_iter):
A /= A.sum(dim=1, keepdim=True)
@PolCPP
PolCPP / dzi2edz.py
Created May 22, 2020 01:45
Quick&Dirty script to transform DZI to EDZ. Should only need py2 bash & command line zip. To run just: python dzi2edz.py duomo duomo/duomo.dzi where duomo is your dzi folder and duomo/duomo.dzi is the xml file
#!/usr/bin/env python
import sys
import json
import os
from zipfile import ZipFile
from xml.dom import minidom
dir_name = sys.argv[1]
fileHeader = 59 + len(dir_name)
// code updates are now there:
// https://github.com/Bleuje/processing-animations-code/blob/main/code/radialcollapse/radialcollapse.pde
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab is be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
// See the license information at the end of this file.
// View the rendered result at: https://bleuje.com/gifanimationsite/single/radialcollapse/
@kylemcdonald
kylemcdonald / dtw_mse.py
Last active April 28, 2021 16:28
DTW MSE numba function for use with UMAP.
# based on https://github.com/kylerbrown/ezdtw
# with modifications to be fully njit-able
import numpy as np
from numba import njit
@njit
def sqeuclidean(a, b):
return np.sum((a - b)**2)
@kylemcdonald
kylemcdonald / Earth Mover's Distance.ipynb
Created April 7, 2019 02:08
Faster 1d Earth Mover's Distance with numpy and numba.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.