Skip to content

Instantly share code, notes, and snippets.

View ludwigschubert's full-sized avatar

Ludwig Schubert ludwigschubert

View GitHub Profile
require 'open-uri'
# Helper Methods
def download url
filename = File.basename(url) # was url.split('/').last
# Removes empty files that returned non 2xx status codes
`wget -qO #{filename} #{url} || rm #{filename}`
print '.'
end
@ludwigschubert
ludwigschubert / chocolat_hang
Created December 3, 2012 20:58
Chocolat Hang with mounted slow network volumes
Sampling process 42531 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Chocolat (pid 42531) every 1 millisecond
Process: Chocolat [42531]
Path: /Applications/Chocolat.app/Contents/MacOS/Chocolat
Load Address: 0x10ec62000
Identifier: Chocolat
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [350]
@ludwigschubert
ludwigschubert / kripp.alpha.R
Created March 17, 2013 20:39
Extraction of R's package irr's source code of Krippendorf's alpha
kripp.alpha<-function (x, method = c("nominal", "ordinal", "interval", "ratio")) {
if(missing(x))
stop("kripp.alpha(x,method=c(\"nominal\",\"ordinal\",\"interval\",\"ratio\"))\n",
"\twhere x is a classifier by object matrix of classifications or scores\n")
method <- match.arg(method)
coincidence.matrix<-function(x) {
levx<-(levels(as.factor(x)))
nval<-length(levx)
cm<-matrix(rep(0, nval * nval), nrow = nval)
dimx<-dim(x)
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Couldn't find Cheffile at ./Cheffile.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
@ludwigschubert
ludwigschubert / Chocolat Crash
Created December 7, 2013 13:12
Chocolat.app crash on sorting a stop words file's lines.
Process: Chocolat [13399]
Path: /Users/USER/*/Chocolat.app/Contents/MacOS/Chocolat
Identifier: com.chocolatapp.Chocolat
Version: 2.0.4 (2.0.4)
Code Type: X86-64 (Native)
Parent Process: launchd [263]
Responsible: Chocolat [13399]
User ID: 501
Date/Time: 2013-12-07 14:01:37.184 +0100
a's
able
about
above
according
accordingly
across
actually
after
afterwards
Process: Chocolat [18043]
Path: /Users/USER/*/Chocolat.app/Contents/MacOS/Chocolat
Identifier: com.chocolatapp.Chocolat
Version: 2.0.4 (2.0.4)
Code Type: X86-64 (Native)
Parent Process: launchd [263]
Responsible: Chocolat [18043]
User ID: 501
Date/Time: 2013-12-07 17:36:25.312 +0100
@ludwigschubert
ludwigschubert / gist:a26929baa2bd9e660c37
Created January 22, 2015 19:54
Stack trace for a crash originating from behaviour in acts_as_list's `swap_changed_attributes`
…list-0.6.0/lib/acts_as_list/active_record/acts/list.rb: 464:in `block in swap_changed_attributes'
…list-0.6.0/lib/acts_as_list/active_record/acts/list.rb: 464:in `each'
…list-0.6.0/lib/acts_as_list/active_record/acts/list.rb: 464:in `swap_changed_attributes'
…list-0.6.0/lib/acts_as_list/active_record/acts/list.rb: 470:in `check_scope'
…/active_record/mass_assignment_security/persistence.rb: 65:in `block in update_attributes'
class ReassignCurators < ActiveRecord::Migration
def up
[
[183, 9436], # Frederik -> Jakob
[305, 9584], # Klara -> Marie
[4885, 9436], # Jeff -> Jakob
[184, 182], # Felix -> Silviu
[4285, 9436], # Tajana -> Jakob
[6407, 9584] # ? -> Marie
].each do |assignment|
@ludwigschubert
ludwigschubert / .block
Created July 30, 2016 16:50 — forked from mbostock/.block
Stacked Bar Chart
license: gpl-3.0