Skip to content

Instantly share code, notes, and snippets.

@mariogeiger
mariogeiger / gist:6019536
Last active March 10, 2017 18:56
quicksort on ipython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mariogeiger
mariogeiger / getmessages.js
Created July 29, 2015 13:07
getMessages() plante
global DATA;
DATA = [];
for (var message in getMessages()) { // à cette ligne : Interruption IA : Erreur d'execution : Trop d'opérations éxécutées pour ce tour
var author = getMessageAuthor(message);
if (getFarmerID(author) !== getFarmerID()) continue;
if (getMessageType(message) !== MESSAGE_CUSTOM) continue;
var content = getMessageParams(message);
if (typeOf(content) !== TYPE_ARRAY or count(content) !== 2) continue;
extern crate lettre;
extern crate env_logger;
use lettre::email::EmailBuilder;
use lettre::transport::smtp::SmtpTransportBuilder;
use lettre::transport::EmailTransport;
use std::error::Error;
fn main() {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mariogeiger
mariogeiger / kernel.py
Created December 5, 2019 15:41
Utilitary file to study Kernels
import torch
def compute_kernel(f, xtr):
'''
:param f: neural network with scalar output
:param xtr: images trainset [P, ...]
'''
ktrtr, _, _ = compute_kernels(f, xtr, xtr[:1])
return ktrtr
import numpy as np
import functools
def einsum(operand, *tensors):
op_in, op_out = operand.split('->')
op_in = op_in.split(',')
assert all(len(op) == x.ndim for op, x in zip(op_in, tensors))
op_out = list(op_out)
@mariogeiger
mariogeiger / spherical_harmonics.py
Created December 8, 2020 17:31
jax code for spherical harmonics
# from sympy.functions.special.spherical_harmonics import Znm
# yl(x, y, z) = -(-1)**l * (-(-1)**m if m >=0 else 1) sqrt(4 pi) * Znm(l, m, acos(z), atan2(y, x))
# assuming x**2 + y**2 + z**2 = 1
import jax
import jax.numpy as jnp
@jax.jit
def y0(x, y, z):
return jnp.stack([
import inspect
class LINE:
def __repr__(self):
return str(inspect.stack()[1].lineno)
__line__ = LINE()
print(__line__)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.