Skip to content

Instantly share code, notes, and snippets.

@gu-ma
gu-ma / parse.py
Last active March 7, 2017 22:08
Parse MIDI files, convert them to ABC, and split instruments into different files
import os
import sys
import subprocess
# from collections import Counter
# import re
# Variables
walk_dir = sys.argv[1]
out_dir = sys.argv[2]
set_name = sys.argv[3]
@gu-ma
gu-ma / clahe.h
Created April 22, 2017 00:14
Clahe script for openFrameworks (need ofxCv.h)
//
// clahe.h
// CLAHE_test
//
// Created by Guillaume on 22.04.17.
//
//
#ifndef clahe_h
#define clahe_h
@gu-ma
gu-ma / faceUtils.h
Last active January 16, 2018 22:20
Face alignment with openFramework + ofxFaceTracker2
//
// faceUtils.h
// Facetracker_face_alignment
//
// Created by Guillaume on 21.08.17.
//
// http://www.pyimagesearch.com/2017/05/22/face-alignment-with-opencv-and-python/
// https://github.com/MasteringOpenCV/code/blob/master/Chapter8_FaceRecognition/preprocessFace.cpp
//
//
@gu-ma
gu-ma / char-rnn-api.py
Last active December 16, 2018 20:40
Example of api to serve a char-rnn-tensorflow model
# Clone and train: https://github.com/sherjilozair/char-rnn-tensorflow/
# then create a file called 'api.py' and run: `python api.py --save_dir='path/to/model'`
# you can call http://0.0.0.0:5002/generate?n=1000&prime='Life is '
#
import argparse
import os
from six.moves import cPickle
#
import tensorflow as tf
from model import Model
@gu-ma
gu-ma / word-rnn-api.py
Created December 16, 2018 20:39
Example of api to serve a word-rnn-tensorflow model
# Clone and train: word-rnn-tensorflow
# then create a file called 'api.py' and run: `python api.py --save_dir='path/to/model'`
# you can call http://0.0.0.0:5002/generate?n=1000&prime='Life is '
#
#
import argparse
import os
from six.moves import cPickle
#
import tensorflow as tf
@gu-ma
gu-ma / easing.h
Created December 2, 2019 13:56
Easing functions
//
// easing.h
// MissMoss
//
// Created by Guillaume on 25.06.18.
//
#ifndef easing_h
#define easing_h
@gu-ma
gu-ma / colab activity hack
Last active June 24, 2021 10:43
Keep colab active (paste in the console)
// Start
let keepActive = setInterval(()=>{
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click();
setTimeout(()=> {
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click();
}, 5000);
}, 60000)
// Stop
clearInterval(keepActive)
@gu-ma
gu-ma / pytorch-glumpy.md
Created January 21, 2021 16:11 — forked from victor-shepardson/pytorch-glumpy.md
using pycuda and glumpy to draw pytorch GPU tensors to the screen without copying to host memory
@gu-ma
gu-ma / pytorch-glumpy.py
Created January 21, 2021 16:11 — forked from victor-shepardson/pytorch-glumpy.py
using pycuda and glumpy to draw pytorch GPU tensors to the screen without copying to host memory
from contextlib import contextmanager
import numpy as np
import torch
from torch import Tensor, ByteTensor
import torch.nn.functional as F
from torch.autograd import Variable
import pycuda.driver
from pycuda.gl import graphics_map_flags
from glumpy import app, gloo, gl
#!/bin/bash
set -e
LIBNDI_INSTALLER_NAME="Install_NDI_SDK_v5_Linux"
LIBNDI_INSTALLER="$LIBNDI_INSTALLER_NAME.tar.gz"
#sudo apt-get install curl
mkdir -p /tmp
pushd /tmp