Skip to content

Instantly share code, notes, and snippets.

View eliemichel's full-sized avatar

Elie Michel eliemichel

View GitHub Profile
@eliemichel
eliemichel / image2gradient.py
Created August 6, 2014 11:00
Convert image to Gimp gradient
View image2gradient.py
import sys
import cv2
import numpy as np
"""
Convert image to Gimp gradient.
Usage: python image2gradient.py input_image
Output gradient in stdout. Place it in something like
~/.config/GIMP/2.x/gradients or
View afanasy_farm_summary.py
# Example of use of Afanasy's API to generate a summary of the state of the
# render farm.
# Copyright (c) 2016 rise|fx (Elie Michel) - Released under MIT License
import af
cmd = af.Cmd()
def isSysJob(job):
return job['st'] == 0
@eliemichel
eliemichel / codeTP2.py
Created November 15, 2016 11:13
MVA — Reinforcement Learning — TP2
View codeTP2.py
# ########################################################################### #
# MVA -- Reinforcement Learning -- TP2
# ########################################################################### #
#
# Code base for the TP2 of the MVA lecture Reinforcement Learning, by
# Alessandro Lazaric. This is a Python port of the MATLAB base provided by the
# TP advisor Émilie Kaufmann:
# http://chercheurs.lille.inria.fr/ekaufman/teaching.html
#
# Do not hesitate to report any suggestion or bugfix to
View getNearestUCDPulse.py
def getNearestUCDpulse(azimuth, elevation, h3D):
"""
retrieves the impulse response from h3D that is closest to the specified
azimuth and elevation (in degrees)
h3D is the array containing all HRTFs for a given subject (left or right)
"""
elmax = 50
elindices = np.arange(elmax)
elevations = -45 + 5.625 * elindices
View selogerHelper.js
/**
* Extrait de code à exécuter dans la console du navigateur pour ajouter
* sous les prix le prix au mètre-carré et le prix par chambre dans les
* résultats de logement sur seloger.com
* Fonctionne au 17/04/2017, mais puisque le code est très ad-hoc il faudra
* sûrement le mettre à jour à chaque màj de seloger.com
*
* Existe aussi pour pap.fr :
* https://gist.github.com/eliemichel/e292bae7b439e15cf7da37ae518f08dc
*
View papHelper.js
/**
* Extrait de code à exécuter dans la console du navigateur pour ajouter
* sous les prix le prix au mètre-carré et le prix par chambre dans les
* résultats de logement sur pap.fr
* Fonctionne au 17/04/2017, mais puisque le code est très ad-hoc il faudra
* sûrement le mettre à jour à chaque màj de pap.fr
*
* Existe aussi pour seloger.com :
* https://gist.github.com/eliemichel/1c6f27be406a22a0d5114020c616d3e8
*
View qless API documentation
Qless server API
================
The first argument is always `now`, the current timestamp. It is not precised for each method in the documentation because bindings usually automatically prepend it to the argument list. But if you are calling the server directly in lua, you will need it.
The best way to have more information about the methods documented here is to look at `api.lua`. The commands available in the API are the members of the `QlessAPI` table, which are easily readable and point to methods provided in other files. For instance, if the body of the method looks like `return Qless.Job(jid):foobar(...)`, then it is likely that the function is defined and documented in `job.lua` because it's getting a `Job` object. If you cannot say at first because it's not using an object, it must be in `base.lua`.
# Config
## config.get([key])
View shadertoy-ldSBWW.glsl
// Author: Élie Michel
// License: CC BY 3.0
// July 2017
void mainImage( out vec4 f, in vec2 c )
{
vec2 u = c / iResolution.xy,
n = texture(iChannel1, u * .1).rg; // Displacement
f = textureLod(iChannel0, u, 2.5);
View rain-drops-280.glsl
#define a(p) textureLod(iChannel0, p, 2.5)
#define t texture(iChannel1,
void mainImage( out vec4 c, vec2 g )
{
c = a(g /= iResolution.xy);
vec2 x = vec2(20);
vec4 n = t round(g*x - .3) / x);
vec2 z = g*x * 6.3 + (t g * .1).rg - .5) * 2.;
x = sin(z) - fract(iTime * (n.b + .1) + n.g) * .5;
View bufA.glsl
// Copyright (c) 2017 - Élie Michel
// License: CC BY 3.0
// Please credit even if you are just re-using the particle system.
// Sync with 'Image' buffer
const float dt = 0.001;
mat3 particleSpaceMatrix(vec2 origin, vec2 velocity) {
vec3 O = vec3(origin, 1.);
vec3 X = normalize(vec3(velocity, 0.));