Skip to content

Instantly share code, notes, and snippets.

Richard Möhn rmoehn

Block or report user

Report or block rmoehn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View none_bug_driver.py
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
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)
0.4304687375015359
cljs.user=> '(meeow)
(meeow)
cljs.user=> (m3-C1 1)
ERROR - cljs.core.m3_C1.call is not a function
cljs.user=> m3-C1
-862048943
@rmoehn
rmoehn / README.md
Last active Nov 11, 2016
Q-learning for the OffSwitchCartPole-v0
View README.md

forgym.py 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
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 [clojure.java.io :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
rmoehn / Dockerfile
Last active Dec 28, 2017
Dockerfile for running Anki inside a Docker Container on Debian Stable
View Dockerfile
# Credits:
#
# - http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
# - https://github.com/jfrazelle/dockerfiles/blob/master/spotify/Dockerfile
#
# 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
rmoehn / paragraphs.py
Created Feb 17, 2016
Makes strings from triple-quoted string literals usable.
View paragraphs.py
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
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 http://sparetimeteaching.dk/note_collections/2015%20Winter.pdf, A Functional Fever Fantasy
(def trans-probs {:living-room
{:living-room 0
:office 0.3
:kitchen 0.5
:desk 0
:bedroom 0.2}
@rmoehn
rmoehn / README-ALP4.md
Last active Aug 29, 2015
Two concurrency course solutions in Go
View README-ALP4.md

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.

License

The MIT License (MIT)

@rmoehn
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
rmoehn / Bilbo
Created Feb 25, 2014
Send emails to multiple people without them seeing the others' addresses and without using Bcc
View Bilbo
#!/usr/bin/perl
use 5.18.0;
use warnings;
use strict;
use autodie qw(:all);
use Perl6::Slurp;
my $bodyfile = shift @ARGV;
my $subject = shift @ARGV;
You can’t perform that action at this time.