Skip to content

Instantly share code, notes, and snippets.

Avatar

Min RK minrk

View GitHub Profile
@minrk
minrk / Retina Figures.ipynb
Created Aug 9, 2012
2x plots for Retina displays with matplotlib and the IPython Notebook
View Retina Figures.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@minrk
minrk / nbstripout
Last active Sep 16, 2020
git pre-commit hook for stripping output from IPython notebooks
View nbstripout
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
LICENSE: Public Domain
View mybinder-diff
#!/usr/bin/env bash
# use helm 2, assumes homebrew
export PATH=/usr/local/opt/helm@2/bin:$PATH
deployments="$@"
if [[ -z "$deployments" ]]; then
deployments="staging prod ovh" # turing
fi
View monte-carlo-pi.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View test.py
import asyncio
from multiprocessing import Process
import random
import statistics
import sys
import time
import zmq
import zmq.asyncio
View test.py
import asyncio
from multiprocessing import Process
import random
import statistics
import sys
import time
import zmq
import zmq.asyncio
View sitecustomize.py
"""
Reorder site-packages ahead of Extras and lib-dynload.
Two implementations:
1. puts site-packages ahead of stdlib (technically hazardous,
but not really an issue).
2. is more conservative, only demoting Extras below site-packages.
Add this to ~/Library/Python/2.7/lib/python/site-packages/sitecustomize.py
"""
View kube-top-pods.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@minrk
minrk / checkipnb.py
Last active Jul 12, 2020
run and validate a notebook
View checkipnb.py
#!/usr/bin/env python
"""
simple example script for running notebooks and reporting exceptions.
Usage: `checkipnb.py foo.ipynb [bar.ipynb [...]]`
Each cell is submitted to the kernel, and checked for errors.
"""
import os,sys,time
View test.py
import os
from tempfile import TemporaryDirectory
from subprocess import check_call
with TemporaryDirectory() as td:
env = {
"HOME": td,
"GIT_COMMITTER_EMAIL": "test@example.com",
"GIT_COMMITTER_NAME": "test",
You can’t perform that action at this time.