Skip to content

Instantly share code, notes, and snippets.

Knock, knock.

Jonathan H sheljohn

Knock, knock.
  • Oxford
View GitHub Profile
sheljohn /
Last active Aug 22, 2018
Python 3 wrapper for os.stat_result
import os, stat, math
import pwd, grp
from datetime import datetime
Wrapper for os.stat_result, which contains all the information I usually need,
in a form that is simple to interact with.
For example:
sheljohn /
Created Aug 17, 2018
wtf-python: Features, not bugs
# Take any version of Python that can import numpy, and run this in a terminal
D=$(mktemp -d) # temporary folder
pushd "$D" # move there
mkdir foo # create subfolder
echo 'import numpy' >| foo/ # script
echo 'x++' >| foo/ # script (invalid)
python foo/ # run
popd # leave temp folder

Keybase proof

I hereby claim:

  • I am sheljohn on github.
  • I am jhadida ( on keybase.
  • I have a public key ASA5lXj8BvOyYA8en01OimcYim0sgaXQ-DNHYacTsjBkGgo

To claim this, I am signing this object:

sheljohn / pubsub.js
Created Sep 15, 2017
Publish/Subscribe singleton in JavaScript
View pubsub.js
* Singleton publish/subscribe hub.
module.exports = (function() {
const channel = {};
const noset = new Set();
return {
publish: (name,data) => {
sheljohn /
Last active Sep 4, 2017
Webpack fails to build on NTFS filesystems
# create temporary directory and move to it
FOLDER=$(mktemp -d)
echo "Moving to folder $FOLDER"
# create a 50M file
echo "Creating empty file $FILE"
sheljohn /
Last active Mar 30, 2020
Print with colors in most shells (Python, standalone)
# Python 2, class
# Author: J.Hadida (jhadida87 at ggooglemail)
class ColorPrinter:
cprint = ColorPrinter()
cprint.rst().out('Bye now...')
sheljohn / gist:a77702e3de1ef8892b7f62665d1d33f5
Created Apr 9, 2016
Fixing FieldTrip issues with Matlab
View gist:a77702e3de1ef8892b7f62665d1d33f5
  • Change directory to fieldtrip, delete all Mex files in the src/ directory
  • Edit src/ft_getopt.c and replace any mxErrMsgTxt to mexErrMsgTxt (notice the 'mex' instead of 'mx')
  • Rename mxSerialize.c to mxSerialize.cpp (same for mxDeserialize)
  • Edit those files, and replace the prototype declarations to:
// MX_API_VER has unfortunately not changed between R2013b and R2014a,
// so we use the new MATRIX_DLL_EXPORT_SYM as an ugly hack instead
#if defined(__cplusplus) && defined(MATRIX_DLL_EXPORT_SYM)
    namespace matrix{ namespace detail{ namespace noninlined{ namespace mx_array_api{
sheljohn /
Last active Nov 30, 2019
Building Armadillo + OpenBLAS [on Intel + Ubuntu]


I actually found very few indications on the net to install Armadillo with OpenBLAS on Ubuntu, and I ran into problems when I tried to install the Ubuntu pre-build packages (using apt-get). So I decided to share my experience building the whole thing from scratch, hopefully this can serve as a step-by-step through the install.


As of writing this, I'm using Ubuntu desktop 14.04 with an Intel i7 4820k Ivy-Bridge E CPU.

You can’t perform that action at this time.