Skip to content

Instantly share code, notes, and snippets.

@mdekstrand
mdekstrand / keybase.md
Created June 3, 2015 13:19
Keybase proof (mdekstrand)

Keybase proof

I hereby claim:

  • I am mdekstrand on github.
  • I am mdekstrand (https://keybase.io/mdekstrand) on keybase.
  • I have a public key whose fingerprint is 2C72 9878 7AAE D8B1 5AE2 2565 0909 5304 B705 7427

To claim this, I am signing this object:

@mdekstrand
mdekstrand / so-recs.css
Created May 29, 2015 17:18
Hide Stack Exchange recommendations
/* User style for Stylish that hides Stack Exchange recommendations. */
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("stackoverflow.com"), domain("stackexchange.com") {
#hot-network-questions {
display: none;
}
}
@mdekstrand
mdekstrand / analyze.R
Last active August 29, 2015 14:08
LensKit Evaluator Analysis
library(ggplot2)
eval.results = read.csv('eval-results.csv')
png('results.png')
qplot(Algorithm, RMSE.ByUser, data=eval.results, geom='boxplot')
dev.off()
@mdekstrand
mdekstrand / eval.groovy
Last active August 29, 2015 14:08
LensKit Evaluator Example
import org.grouplens.lenskit.iterative.*
import org.grouplens.lenskit.knn.item.*
import org.grouplens.lenskit.mf.funksvd.*
import org.grouplens.lenskit.transform.normalize.*
trainTest {
dataset crossfold("ml-100k") {
source csvfile("ml-100k/u.data") {
delimiter "\t"
domain {
CREATE TABLE ratings (user INTEGER, item INTEGER, rating REAL, timestamp INTEGER);
CREATE INDEX rating_user_index ON ratings (user);
CREATE INDEX rating_item_index ON ratings (item);
@mdekstrand
mdekstrand / filter-lines.sh
Created November 14, 2013 23:51
Script to filter the lines of a file, printing out 'intersting' ones. Useful for filtering lists of things in shell init scripts.
#!/bin/sh
verbose=no
if [ "$1" = -v ]; then
verbose=yes
shift
fi
debug()
{
@mdekstrand
mdekstrand / gist:6400495
Created August 31, 2013 20:38
JRuby nanoc stack trace
Message:
RegexpError: invalid multibyte character: /…/
Compilation stack:
(empty)
Stack trace:
@mdekstrand
mdekstrand / maven-tmpfs-snippet.xml
Last active December 21, 2015 14:38
Maven snippet to make target/ a symlink out to temp space. This snippet is in the public domain. For more explanation, see http://elehack.net/writings/programming/maven-target-in-tmpfs
<profile>
<id>external-build-dir</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>external.build.root</name>
</property>
</activation>
<build>
<plugins>
@mdekstrand
mdekstrand / Rspin.R
Created May 2, 2013 16:37
Script to spin R files using knitr.
#!/usr/bin/env Rscript
library(knitr)
for (arg in commandArgs(trailingOnly=TRUE)) {
spin(arg)
}
@mdekstrand
mdekstrand / path-types-process.scala
Created January 12, 2013 18:23
Processing code for path-dependent types post.
def fetch[T](req: WebRequest[T]): Result[T]
def process(need: Need) {
val req = need.request
val res = fetch(req)
// now we save the data
res match {
case Good(data) => need.save(store, data)
/* error cases */
}