Skip to content

Instantly share code, notes, and snippets.

View main.html
<body>
{{> hello}}
</body>
<template name="hello">
{{#with people}}
{{count}}
{{/with}}
</template>
@mrw34
mrw34 / geoip.sh
Last active Dec 20, 2015
Convert IP addresses (e.g. from httpd logs) to GeoJSON
View geoip.sh
#!/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 Dec 19, 2015 — forked from t-ob/west.clj
View 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 Jul 12, 2013
Userscript to replace iCal downloads on traintimes.org.uk with links to Google Calendar's event creation page
View traintimes_gcal.user.js
// ==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);
}
View TestUnstash.java
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);