Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Matthias Bussonnier Carreau

:octocat:
View GitHub Profile
@Carreau
Carreau / custom.js
Last active Sep 13, 2018
Beep when kernel idle after 10 sec busy
View custom.js
// put in your .jupyter/custom/custom.js
require(['base/js/events'], function(events){
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBz
View ndoc.py
import numpy.random as nr
import docutils
import docutils.frontend
import docutils.parsers
import docutils.parsers.rst
import numpydoc.docscrape as nd
import pygments
import textwrap
from pygments.lexers import Python3Lexer
from pygments.token import Token
View Viridisify.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View BinderLogo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Carreau
Carreau / main.rs
Last active Mar 3, 2018
Rust From error
View main.rs
// in the following snippet, cargo complains:
//
// error[E0277]: the trait bound `B: std::convert::From<&A>` is not satisfied
// --> src/main.rs:54:21
// |
// 54 | let dn: B = B::from(n);
// | ^^^^^^^ the trait `std::convert::From<&A>` is not implemented for `B`
// |
// = help: the following implementations were found:
// <B as std::convert::From<A>>
@Carreau
Carreau / phantomtest.js
Created Nov 4, 2012
Headless run-all notebook
View phantomtest.js
page = require('webpage').create();
var system = require('system');
var fs = require("fs");
// notebook uuid to load.
var uuid = system.args[1];
var noop = function(){}
// external action to map on console.log message of embeded
@Carreau
Carreau / proof
Created Oct 14, 2017
Keybase Proof
View proof
### Keybase proof
I hereby claim:
* I am carreau on github.
* I am mbussonn (https://keybase.io/mbussonn) on keybase.
* I have a public key ASCnMPrYcBgBueQ180i9ks1TWulXMXFYs_bdj1xJ6pVxtgo
To claim this, I am signing this object:
@Carreau
Carreau / foo.py
Created Sep 20, 2017
import magic.
View foo.py
from IPython.core.magic import Magics, magics_class, line_magic
@magics_class
class Waskom(Magics):
@line_magic
def michael(self, line):
self.shell.set_next_input('import seaborn as sns')
ip = get_ipython()
View Disp-Requests.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:4ed0987c3671d9cb92cf3b8a29542619
In [12]: jedi.Interpreter('s.dat',[ {'s':s}], line=1, column=5).completions()[0].type
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Users/bussonniermatthias/dev/jedi/jedi/parser/utils.py in wrapper(self)
37 try:
---> 38 return getattr(self, name)
39 except AttributeError:
AttributeError: 'CompiledName' object has no attribute '_infer'
You can’t perform that action at this time.