Skip to content

Instantly share code, notes, and snippets.

View alimuldal's full-sized avatar

Alistair Muldal alimuldal

  • DeepMind
  • London, UK
View GitHub Profile
@alimuldal
alimuldal / recover
Created November 11, 2015 16:18
Python script for automated file recovery using SleuthKit
#!/usr/bin/env python
import argparse
import subprocess
import re
import os
TYPECODES = ['\-', 'r', 'd', 'b', 'l', 'p', 's', 'w', 'v']
DESCRIPTIONS = [
'unknown type',
@alimuldal
alimuldal / urows.py
Created October 20, 2015 00:14
numpy unique rows
def unique_rows(a, **kwargs):
rowtype = np.dtype((np.void, a.dtype.itemsize * a.shape[1]))
b = np.ascontiguousarray(a).view(rowtype)
return_index = kwargs.pop('return_index', False)
out = np.unique(b, return_index=True, **kwargs)
idx = out[1]
uvals = a[idx]
if (not return_index) and (len(out) == 2):
@alimuldal
alimuldal / test_numpy.py
Last active April 5, 2020 10:25
test script for numpy BLAS linkage
#!/usr/bin/env python
import numpy
from numpy.distutils.system_info import get_info
import sys
import timeit
print("version: %s" % numpy.__version__)
print("maxint: %i\n" % sys.maxsize)
info = get_info('blas_opt')
# Copyright 2014 Alistair Muldal <[email protected]>
import numpy as np
import igraph
from itertools import izip, combinations, product
def bansal_shuffle(G, target_gcc, tol=1E-3, maxiter=None, inplace=True,
require_connected=False, seed=None, verbose=False):
r"""
@alimuldal
alimuldal / nemenyi.py
Last active May 25, 2020 09:39
Implementation of Nemenyi's multiple comparison test, following a Kruskal-Wallis 1-way ANOVA
import numpy as np
from scipy import stats
from itertools import combinations
from statsmodels.stats.multitest import multipletests
from statsmodels.stats.libqsturng import psturng
import warnings
def kw_nemenyi(groups, to_compare=None, alpha=0.05, method='tukey'):
"""
@alimuldal
alimuldal / dunn.py
Last active October 5, 2023 06:04
Implementation of Dunn's multiple comparison test, following a Kruskal-Wallis 1-way ANOVA
import numpy as np
from scipy import stats
from itertools import combinations
from statsmodels.stats.multitest import multipletests
from statsmodels.stats.libqsturng import psturng
import warnings
def kw_dunn(groups, to_compare=None, alpha=0.05, method='bonf'):
"""
from OpenGL import GL as gl
from OpenGL import GLUT as glut
from OpenGL.arrays import vbo
import numpy as np
from scipy.misc import lena
class TextureQuad2D(object):
def __init__(self, texdata, rect=(-1., -1., 1., 1.)):