Skip to content

Instantly share code, notes, and snippets.

View thcyron's full-sized avatar

Thomas Cyron thcyron

View GitHub Profile
@thcyron
thcyron / schedule.rb
Last active November 28, 2015 18:13
Ruby script to generate .ics files for the Staatstheater Nürnberg schedule
require "net/http"
require "nokogiri"
require "date"
require "json"
require "digest/sha1"
class Schedule
attr_reader :genre
def initialize
@thcyron
thcyron / twitterwater.clj
Created November 18, 2013 21:01
Clojure solution to the Twitter Waterfall Problem http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/
(defn twitterwater
([array] (twitterwater array 0))
([array v]
(let [reducer (fn [state n] (if (:count? state)
(if (> n 0)
(assoc state :av 0 :v (+ (:v state) (:av state)))
(assoc state :av (inc (:av state))))
(if (> n 0)
(assoc state :count? true)
state)))
#!/bin/sh
step() {
echo "-----> $@"
}
run() {
$* 2>&1 | while read line; do
echo " $line"
done