Skip to content

Instantly share code, notes, and snippets.


Samuel John samueljohn

View GitHub Profile
pbugnion /
Last active Jun 4, 2021
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

senko /
Last active Mar 19, 2021
A Pythonic implementation of the Maybe monad
# - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
mblondel /
Last active Feb 13, 2019
Frequent directions algorithm for matrix sketching.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
from scipy.linalg import svd
def frequent_directions(A, ell, verbose=False):
Return the sketch of matrix A.