Skip to content

Instantly share code, notes, and snippets.


Richard Möhn rmoehn

View GitHub Profile
import sys
from patchwork.actions import Reply, Unlock
from patchwork.datastore import Datastore
from patchwork.scheduling import RootQuestionSession, Scheduler
from patchwork.text_manipulation import make_link_texts
def main():
db = Datastore()
sched = Scheduler(db)
rmoehn / dump-1489371711841.cljs
Created Mar 13, 2017
ClojureScript REPL dump
View dump-1489371711841.cljs
cljs.user=> (.text (js/jQuery "#title") "bla")
ERROR - jQuery is not defined
cljs.user=> (rand)
cljs.user=> '(meeow)
cljs.user=> (m3-C1 1)
ERROR - is not a function
cljs.user=> m3-C1
rmoehn /
Last active Nov 11, 2016
Q-learning for the OffSwitchCartPole-v0
View can be found in the context of its repo here. I made this Gist, so that I can include it with my OpenAI Gym upload.

For much more interesting information than this short script and the reward graph, have a look at (Non-)Interruptibility of Sarsa(λ) and Q-Learning.

rmoehn / user.clj
Created Oct 22, 2016
Clojure is the new Perl – Loading Markdown files into Jupyter Notebooks/IPython Notebooks using Specter and Cheshire
View user.clj
(ns user
(:require [ :as io]
[clojure.string :as string]
[cheshire.core :as cheshire]
[com.rpl.specter :as s]))
;;; Dependencies: [org.clojure/clojure "1.9.0-alpha13"]
;;; [cheshire "5.6.3"]
;;; [com.rpl/specter "0.13.0"]]
rmoehn / Dockerfile
Last active Dec 28, 2017
Dockerfile for running Anki inside a Docker Container on Debian Stable
View Dockerfile
# Credits:
# -
# -
# Note:
# This Dockerfile sets up everything for studying Japanese with Anki. ADAPT
# comments point to what you'll probably need to adapt to your situation.
rmoehn /
Created Feb 17, 2016
Makes strings from triple-quoted string literals usable.
import re
import textwrap
def paragraphs(u):
Makes strings from triple-quoted string literals usable.
When you write a string as a triple-quoted literal, you end up with
something that has superfluous newlines and lots of empty space from the
indentation, like this::
rmoehn / cleaning-robot.clj
Last active Aug 29, 2015
Most likely chain of rooms a cleaning robot has visited given initial and final state
View cleaning-robot.clj
(ns user)
;;; See, A Functional Fever Fantasy
(def trans-probs {:living-room
{:living-room 0
:office 0.3
:kitchen 0.5
:desk 0
:bedroom 0.2}
rmoehn /
Last active Aug 29, 2015
Two concurrency course solutions in Go

Selected Solutions to Concurrency Course Exercises

In 2013 I took the course in nonsequential programming at my university. The programming language used was Google Go and here are the solutions to two of the exercises.

  • smokers.go is a solution to the cigarette smokers problem. Contains a fancy ASCII art animation.
  • p2p-chat.go is peer-to-peer chat using the algorithm of Ricart and Agrawala for mutual exclusion. This is probably not the usual way to do things and, not using a Lamport clock, only works with multiple processes on one machine. However, it might still be interesting.


The MIT License (MIT)

rmoehn / ddist-manuscripts
Last active Aug 29, 2015
Manuscripts for oral exam in distributed systems
View ddist-manuscripts
01 Remote Procedure Call + RMI
Motivation and Idea
- server offers some service, client wants to use it
- traditional: socket connection to server, use some text-oriented
protocol with requests and responses (fx HTTP) – PIC!
- idea: want to use the the server's service just as if it was another
library; function call whose body is executed remotely – PIC!
rmoehn / Bilbo
Created Feb 25, 2014
Send emails to multiple people without them seeing the others' addresses and without using Bcc
View Bilbo
use 5.18.0;
use warnings;
use strict;
use autodie qw(:all);
use Perl6::Slurp;
my $bodyfile = shift @ARGV;
my $subject = shift @ARGV;