Skip to content

Instantly share code, notes, and snippets.

@SteveUpton
SteveUpton / TMAXX.tex
Last active September 20, 2023 15:30 — forked from matth/assignment.tex
Open University TMA LaTeX class and example TMA.
\documentclass{ou-tma}
\student{John Smith}
\email{john@example.com}
\identifier{B1234567}
\course{S282}
\coursetitle{Astronomy}
\tma{1}
\begin{document}
@SteveUpton
SteveUpton / yb-to-linestring.sql
Created March 31, 2015 23:04
Converts a CartoDB table generated from YB Tracking YML into a linestring
-- Generate the timestamp from the supplied data
UPDATE yb
SET timestamp=to_timestamp(SUBSTRING(name, 7, 20), 'DD-MM-YYYY HH24:MI:SS');
-- Generate the linestring as a new table
CREATE TABLE yb_linestring AS (
SELECT
ST_MakeLine(the_geom ORDER BY timestamp) AS the_geom
FROM yb);
@SteveUpton
SteveUpton / distanceCalculator.js
Last active March 4, 2016 19:10
Given LocationHistory.json exported from Google Location History, calculates total distance traveled and estimates how much was walked.
results = require('./LocationHistory.json')
.locations
.map(function (location) {
return {
time: location.timestampMs,
lat: location.latitudeE7 / 10000000,
long: location.longitudeE7 / 10000000,
}
})
.reduce(function (results, curr, index, array) {
@SteveUpton
SteveUpton / package.json
Last active July 3, 2023 16:10
Replaces 'wand' with 'penis' in Harry Potter ebooks
{
"name": "penisify",
"version": "1.0.0",
"description": "Takes a (DRM-free) Harry Potter epub file and replaces every instance of the word 'wand' with 'penis'.",
"repository": {
"url": "https://gist.github.com/b22cfa656b54da1ab47683d7663a6676.git"
},
"keywords": [
"harry potter",
"penis"