Skip to content

Instantly share code, notes, and snippets.

View lesteve's full-sized avatar

Loïc Estève lesteve

View GitHub Profile
@lesteve
lesteve / ipkernelapp_outside_main_thread.py
Last active February 22, 2018 02:31
Starting an ipython kernel outside the main thread
import threading
import sys
import signal
# this is the heavy monkey-patching that actually works
# i.e. you can start the kernel fine and connect to it e.g. via
# ipython console --existing
# signal.signal = lambda *args, **kw: None
from IPython.zmq.ipkernel import IPKernelApp
app = IPKernelApp.instance()
@lesteve
lesteve / embed_kernel_and_connected_notebook.py
Created March 22, 2013 00:17
Embedding a kernel and starting a ipython notebook that knows how to connect to it. Kind of a work-around similar to ipython notebook --existing if it existed.
from IPython import embed_kernel
import start_notebook
def main():
p = start_notebook.main()
localDict = { 'a':1, 'b':2 }
embed_kernel()
p.kill()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lesteve
lesteve / line_with_scientific_notation_coordinates.svg
Created September 8, 2014 21:16
SVG using scientific notation for one of its path coordinates
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lesteve
lesteve / joblib_bench.py
Created March 11, 2015 09:22
joblib simple benchmark
import time
import sys
import numpy as np
np.random.seed(0)
N = int(1e7)
big_array = np.random.random(N)
@lesteve
lesteve / test_sklearn_issue_5136.py
Last active October 13, 2015 16:38
Reproducing scikit-learn issue #5136
import pandas as pd
import numpy as np
from sklearn.naive_bayes import MultinomialNB
import unicodedata
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cross_validation import train_test_split
path='./BUG-SKLEARN-MNB/'
#%% load et normalisation des donnees
# def norm(x):
@lesteve
lesteve / README.md
Last active March 2, 2018 08:52
Greasemonkey script to fold/unfold outdated diffs on github PRs
@lesteve
lesteve / resize_smart_cython_0.21.1.ipynb
Created October 18, 2016 14:21
cython resize_smart speed regression
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from copy import copy
import numpy as np
from sklearn.base import clone
from sklearn.utils import check_random_state
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.externals import joblib
@lesteve
lesteve / README.md
Last active March 2, 2018 08:54
Greasemonkey script that adds a button to the PR page to open the doc generated by CircleCI for this PR.