Instantly share code, notes, and snippets.

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)
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
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.

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"]]
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.
#
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::
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}
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)

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!
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;