Skip to content

Instantly share code, notes, and snippets.

@mrw34
mrw34 / main.html
Created April 2, 2014 15:24
meteor-with
<body>
{{> hello}}
</body>
<template name="hello">
{{#with people}}
{{count}}
{{/with}}
</template>
@mrw34
mrw34 / geoip.sh
Last active December 20, 2015 08:49
Convert IP addresses (e.g. from httpd logs) to GeoJSON
#!/bin/bash -eu
echo {\"type\": \"GeometryCollection\", \"geometries\": [
sep=
while read ip ; do
coordinates=$(curl -s freegeoip.net/csv/$ip | csvtool col 9,8 -)
echo $sep{\"type\": \"Point\", \"coordinates\": [$coordinates]}
sep=,
done
echo ]}
@mrw34
mrw34 / west.clj
Last active December 19, 2015 20:49 — forked from t-ob/west.clj
(ns genetic.core)
(def letters
(conj (map (comp char
(partial + 97))
(range 26))
\space))
(defn random-string [source]
(let [length (count source)]
@mrw34
mrw34 / traintimes_gcal.user.js
Created July 12, 2013 19:00
Userscript to replace iCal downloads on traintimes.org.uk with links to Google Calendar's event creation page
// ==UserScript==
// @match http://traintimes.org.uk/*
// ==/UserScript==
(function() {
var icals = document.getElementsByClassName("ical");
for (var i = 0; i < icals.length; i++) {
icals[i].href = 'http://markwoodbridge.appspot.com/ical?url=' + encodeURIComponent(icals[i].href);
}
import java.io.File;
import java.util.UUID;
import org.eclipse.jgit.api.Git;
public class TestUnstash {
public static void main(String[] args) throws Exception {
File directory = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
directory.mkdir();
File.createTempFile("blank", null, directory);