Skip to content

Instantly share code, notes, and snippets.

Working from home

David Ojeda dojeda

Working from home
  • Paris, France
View GitHub Profile
dojeda /
Created Jun 8, 2020
Comparison of distance functions on covariance matrices
from functools import partial
import matplotlib.pyplot as plt
import numpy as np
from pyriemann.utils.distance import distance_riemann
@partial(np.vectorize, excluded=['ref'])
def distance_riemann_v(c_xx, c_yy, ref):
""" Vectorized version of distance_riemann projected in 2D
dojeda / openapi.yaml
Created Feb 17, 2019
Example OpenAPI specification for inline model bug reproduction
View openapi.yaml
openapi: "3.0.0"
version: 1.0.0
title: Swagger Petstore
name: MIT
- url:
dojeda /
Last active Mar 22, 2018
Epoching of 2D array on its last dimension using a view (not a copy)
""" Small proof of concept of an epoching function using NumPy strides
License: BSD-3-Clause
Copyright: David Ojeda <>, 2018
import numpy as np
from numpy.lib import stride_tricks
View eigen_mwe.cpp
#include <iostream>
#include <vector>
#include <Eigen/Dense>
int main(int argc, char *argv[]) {
Eigen::MatrixXd X = Eigen::MatrixXd::Random(3, 3);
// PCA = EVD of the covariance matrix
Eigen::SelfAdjointEigenSolver < Eigen::MatrixXd > solver(X.selfadjointView<Eigen::Lower>());
dojeda / trigraphs-c++
Created Apr 15, 2015
TIL about trigraphs in C and C++. Wat the fk!
View trigraphs-c++
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main(int , char *[]) {
vector<int> v1 = {0,1,2};
View square root 2
#!/usr/bin/env python
def sqrt(x):
begin = 0
end = x
while begin <= end:
mid = begin + (end - begin) // 2
You can’t perform that action at this time.