Skip to content

Instantly share code, notes, and snippets.

View Carreau's full-sized avatar
:octocat:

M Bussonnier Carreau

:octocat:
View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active April 22, 2024 15:40
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
import ast
import types
import ctypes
# Really what we want, I think are compile modes "async_exec", "async_single",
# "async_eval". These would:
#
# - turn on await
# - turn on the coroutine flags, so that passing the code to exec() returns a
# coroutine object
import jwt
import requests
from time import time
pem_file = '/path/to/github.pem' # the absolute path to your Application Pem Certificate issued by GitHub
integration_id = 0 # GitHub Application Integration ID
installation_id = 0 # once installed on an organization. The Organization Integration ID
expire_seconds = 500 # number of seconds the jwt token expires (max ~600 but not designated by GitHub)
slug = 'owner/repo' # name of repo for demo purposes
@juhasch
juhasch / custom.js
Last active January 3, 2016 04:19
My custom.js for the new IPython notebook 2.0 UI
// leave at least 2 line with only a star on it below, or doc generation fails
/**
*
*
*/
/*
* Wait for app_initialized.NotebookApp trigger
*/
#!/usr/bin/env ruby
#
# git fuzzy-checkout
# Same as `git checkout branch`, but with fuzzy matching if checkout fails.
# Turns `git checkout barnch` into `git checkout branch`,
# assuming `branch` is a branch.
# to use, you can alias:
# alias co="git fuzzy-checkout"
# co msater
// add this to <profile>/static/custom/custom.js to load vim keybindings:
$.getScript("/static/components/codemirror/keymap/vim.js", function() {
if (! IPython.Cell) return;
IPython.Cell.options_default.cm_config.keyMap = "vim";
});
@juhasch
juhasch / euext.py
Last active December 11, 2015 11:59
Allow to use units with numbers in iPython, e.g. "1n"=1e-9 or "1G"=1e9
# -*- coding: utf-8 -*-
"""
IPython extension for engineering units
See README.txt for usage examples.
Author: Juergen Hasch <python@elbonia.de>
Parts taken from the physics.py extension by Georg Brandl <georg@python.org>
This file has been placed in the public domain.
Allows units to be specified like
@dwf
dwf / theanoprinting.py
Created December 19, 2012 21:21
IPython extension for automatically PNG-pretty-printing Theano functions with Graphviz.
"""Display Theano functions in the IPython notebook with pydotprint."""
__author__ = "David Warde-Farley"
__copyright__ = "Copyright 2012, Universite de Montreal"
__credits__ = ["David Warde-Farley"]
__license__ = "3-clause BSD"
__email__ = "wardefar@iro"
__maintainer__ = "David Warde-Farley"
@Carreau
Carreau / kernel.js
Created December 13, 2012 20:09
A node.js kernel for IPython notebook. You can see the explanation of the ipynb rendered in http://nbviewer.ipython.org
zmq = require("zmq")
fs = require("fs")
var config = JSON.parse(fs.readFileSync(process.argv[2]))
var connexion = "tcp://"+config.ip+":"
var shell_conn = connexion+config.shell_port
var pub_conn = connexion+config.iopub_port
var hb_conn = connexion+config.hb_port