Skip to content

Instantly share code, notes, and snippets.

@MMesch
MMesch / shell.nix
Last active April 23, 2019 23:30
nix-shell for tensorflow hub and google Bert
{ pkgs ? import <nixpkgs> {} }:
let
bertTfHubModule = builtins.fetchTarball {
url="https://tfhub.dev/google/bert_multi_cased_L-12_H-768_A-12/1?tf-hub-format=compressed";
sha256="sha256:01svqqhs4jlpi0lax3kr4cj43kfjvvvzlhd2gkb61849hish3qk3";
};
googleBertSrc = pkgs.fetchFromGitHub {
owner = "google-research";
repo = "bert";
@MMesch
MMesch / .gistup
Created December 18, 2018 10:04
experimental nix-jupyter setup
gistup
gistup
@MMesch
MMesch / mypersonality.py
Created May 28, 2018 09:41
minimal custom personality for the Jupyter kernel gateway
# Modified from:
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""
Custom personality for the jupyter kernel gateway.
This personality adds a custom handler under:
localhost:xxxx/MyHandler
To start the kernel gateway with the custom personality, execute
@MMesch
MMesch / run.sh
Created May 26, 2018 09:02
jupyter kernel gateway communication from bash
#!/usr/bin/env bash
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
echo -e "\n==== START GATEWAY ===="
jupyter kernelgateway --JupyterWebsocketPersonality.list_kernels=True &
sleep 3
echo -e "\n==== PING GATEWAY API ===="
@MMesch
MMesch / gateway_websocket.py
Last active May 26, 2018 09:49
demonstration of async communication between jupyter kernelgateway and aiohttp
#!/usr/bin/env python
"""
Simple demonstration of a aiohttp <-> Jupyter kernel gateway communication.
before running this script, the jupyter kernel gateway should be started with:
$ jupyter kernelgateway --JupyterWebsocketPersonality.list_kernels=True
"""
import aiohttp
@MMesch
MMesch / Python_Jupyter_Interaction.ipynb
Last active January 15, 2023 07:28
simple illustration of jupyter kernel messaging
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MMesch
MMesch / Geometry.hs
Last active March 10, 2018 17:06
Call Haskell from Python, mini project after https://wiki.python.org/moin/PythonVsHaskell
{-# LANGUAGE ForeignFunctionInterface #-}
module Geometry where
import Foreign.C.Types
import Foreign.C.String
add :: Num a => a -> a -> a
add x y = x + y
@MMesch
MMesch / README.md
Created March 5, 2018 14:11
python refactoring commands

Python Refactoring Strategies

project structure and workflow

git and CI

check if git and CI are setup

folder tree

@MMesch
MMesch / README.md
Last active January 31, 2018 12:21
food network

Visualization of the time-dependent correlation matrix of the food production of 245 countries from the united nations.