Skip to content

Instantly share code, notes, and snippets.

View rmoehn's full-sized avatar

Richard Möhn rmoehn

View GitHub Profile
@rmoehn
rmoehn / Kochtagebuch
Last active August 29, 2015 13:56
Notizen zu einigen meiner Kochexperimente. – Ursprünglich nicht für die Öffentlichkeit geschrieben, aber vielleicht doch nützlich.
1 rcup = 160 ml
irgendwannmal: Fermentierte Birnen
- Zubereitung:
Birnen ausschneiden, vierteln, in Gläser tun. Ein bisschen (EL?) Hafer-
oder Roggenferment und etwas Salz darauftun. Mit Wasser auffüllen.
Einige Zeit gären lassen, dann in den Kühlschrank.
- Hinweise:
* Gläser nicht zu voll machen, damit sie nicht überlaufen.
* Birnen möglichst nicht aus der Flüssigkeit herausschauen lassen,
@rmoehn
rmoehn / Bilbo
Created February 25, 2014 16:57
Send emails to multiple people without them seeing the others' addresses and without using Bcc
#!/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;
@rmoehn
rmoehn / ddist-manuscripts
Last active August 29, 2015 13:57
Manuscripts for oral exam in distributed systems
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 / README-ALP4.md
Last active August 29, 2015 13:57
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.

License

The MIT License (MIT)

@rmoehn
rmoehn / cleaning-robot.clj
Last active August 29, 2015 14:15
Most likely chain of rooms a cleaning robot has visited given initial and final state
(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 / gist:508094
Created August 4, 2010 12:58
Katrin - an email reminder
#!/usr/bin/env perl
=head1 NAME
B<Katrin> - remind via local mail
=head1 DESCRIPTION
B<Katrin> searches for files of a special format in the directory
F<~/.katrin> and sends out reminder emails to a specified user via
@rmoehn
rmoehn / paragraphs.py
Created February 17, 2016 14:34
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
rmoehn / user.clj
Created October 22, 2016 04:50
Clojure is the new Perl – Loading Markdown files into Jupyter Notebooks/IPython Notebooks using Specter and Cheshire
(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 / README.md
Last active November 11, 2016 02:14
Q-learning for the OffSwitchCartPole-v0

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 / dump-1489371711841.cljs
Created March 13, 2017 02:21
ClojureScript REPL dump
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