Skip to content

Instantly share code, notes, and snippets.

View tomMoral's full-sized avatar

Thomas Moreau tomMoral

View GitHub Profile
@tomMoral
tomMoral / install_conda.sh
Last active September 15, 2023 12:11
Install conda
#!/bin/bash
install_conda(){
_USAGE="Usage
=====
./install_conda.sh <--gpu> <--prefix|-p DIR>
Install conda with miniforge on the system.
@tomMoral
tomMoral / marcenko_pastur.py
Created January 19, 2021 13:31
Simulate Marcenko-Pastur Law
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
# activate latex text rendering
rc('text', usetex=True)
if __name__ == "__main__":
#include <mpi.h>
#include <iostream>
using namespace MPI;
using namespace std;
int main(int argc, char**argv) {
//Initiate the MPI API
@tomMoral
tomMoral / deadlock_unpickle_results.py
Last active October 5, 2017 07:35
Deadlocks with concurrent.futuress.ProcessPoolExecutor and unpicklable objects
"""
This example highlights the fact that the ProcessPoolExecutor implementation
from concurrent.futures is not robust to unpickling error for the result
(at least in versions 3.6 and lower).
"""
from pickle import UnpicklingError
from concurrent.futures import ProcessPoolExecutor
def return_instance(cls):
$ python -c "if 1:
import numpy as np
from sklearn.manifold.t_sne import TSNE, trustworthiness
from sklearn.utils import check_random_state
random_state = check_random_state(0)
X = random_state.randn(50, 2).astype(np.float32)
n_iter = 250
tsne = TSNE(n_components=2, init='pca', random_state=0,
method='barnes_hut', verbose=20, n_iter=n_iter)
@tomMoral
tomMoral / basic_func.py
Last active February 8, 2022 15:24
Add a coverage logger thread to get access to coverage in real time
from time import sleep
def func0():
print("run func0")
sleep(1)
print("ran func0")
def func1():
@tomMoral
tomMoral / mgr_test.py
Created October 17, 2016 08:22
Test file for multiprocessing Manager list
import multiprocessing as mp
from multiprocessing import Manager
def test(idx, list_out):
list_out.append(idx)
if __name__ == '__main__':
mgr = Manager()