Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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
gistup
@MMesch
MMesch / .gistup
Created December 18, 2018 10:04
experimental nix-jupyter setup
gistup
@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 / docker-compose.yml
Created June 19, 2019 19:33
elasticsearch neo4j dejavu tomcat docker compose file
version: '2.0'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.5.1
container_name: elasticsearch
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
@MMesch
MMesch / .gistup
Created January 13, 2020 15:06
monad-bayes walkthrough
gistup