View plist-to-yaml.rb
#!/usr/local/bin/ruby
# encoding: UTF-8
require 'yaml'
require "base64"
require 'rexml/document'
class PList < BasicObject
ELEMENT_PROCESSORS = {}
def self.process_element_named(name, &block); ELEMENT_PROCESSORS[name.to_s] = block; end
def self.process_element(elt) ; ELEMENT_PROCESSORS[elt.name][elt]; end
View yaml-to-plist.rb
#!/usr/bin/env ruby
# encoding: UTF-8
require 'yaml'
require 'rexml/document'
class PlistWriter
PLIST_STUB_DOC = %q[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"></plist>]
View ftff-events.rb
#!/usr/bin/ruby
# encoding: UTF-8
require 'rubygems'
require 'fsevent'
require 'shellwords'
class Time
def age_in_seconds(now = Time.now)
now - self
View infix-functions.swift
infix operator « { precedence 131 associativity left }
func «<A,B,C>(a:A, f:(A,B) -> C) -> B -> C { return { f(a,$0) } }
infix operator » { precedence 131 associativity left }
func »<B,C>(f:(B) -> C, b:B) -> C { return f(b) }
infix operator < { precedence 131 associativity left }
func <<A,B,C>(a:A, f:(A,B) -> C) -> B -> C { return { f(a,$0) } }
infix operator > { precedence 131 associativity left }
View wgt.rb
#!/usr/bin/env ruby
s = ARGF.read =~ /Freitag, 13. Mai 2016.*?(?=\n\n)/m && $&
s.gsub! /^(\d\d)\.(\d\d)\u00A0Uhr\n/, "\\1:\\2h -- "
days = []
s.lines.each do |l|
case l
when /^\d\d:\d\dh -- Einlaß/ then :pass
when /Mai 2016$/ then days << [l, []]
when /^\d\d:\d\dh -- / then days.last[1] << l.sub(/\Z/, " -- @ #{$x}")
View keybase.md

Keybase proof

I hereby claim:

  • I am kch on github.
  • I am kch (https://keybase.io/kch) on keybase.
  • I have a public key whose fingerprint is 896A A376 3566 F68D 066B 5BEF EAF6 44A0 0B63 A2DE

To claim this, I am signing this object:

View rooftop.md

Pedro's Amazing Guide To Rooftop Bars

Very few people respect the art of rooftop drinking these days.

The problem faced by Rooftop bars is that their customers often believe they're being respectful because they're wearing a suit or a fancy dress.

Niclekback wears suits

Nevermind all the people that COMPLETELY FUCKED UP MUSIC AS WE KNOW IT while dressing well. We're still associating fancy dressing with respect.

View safari.rb
#!/usr/bin/env ruby
($stderr.puts(DATA.read.gsub("$0", File.basename($0))); exit 1) if ARGV.length != 1
require 'appscript'
safari_app = Appscript.app("Safari")
safari_process = Appscript.app('System Events').processes['Safari']
safari_app.activate
View pdfpen-merge-documents.rb
#!/usr/bin/env ruby
# encoding: UTF-8
# merge pages from two pdf documents (same as Merge Every Other)
# only the two documents to be merged must be opened, the first must be the front window.
# this assumes a feed scanner, hence expects the second document's pages to be reversed.
require 'appscript'
include Appscript
View Play Selected Track Next.rb
#!/usr/bin/env ruby
# encoding: UTF-8
pid = fork and (Process.detach(pid); exit) # Go to background.
require 'appscript'
SRC_MACRUBY_WAIT_FOR_PLAYER_NOTIFICATION = <<-RUBY
framework "Cocoa"
def playerInfo(notification); exit; end