Skip to content

Instantly share code, notes, and snippets.

@harry-wood
harry-wood / comment-url-filter.php
Last active August 29, 2015 14:01
Little wordpress plugin to block some comments with crappy URLs
<?php
/*
* Plugin Name: Comment URL filter
* Description: Block some comments with crappy URLs
*/
function filter_handler( $approved , $commentdata )
{
$url = $commentdata['comment_author_url'];
@harry-wood
harry-wood / earlypubs.geojson
Created August 3, 2014 20:47
Looking back at OpenStreetMap early mapping. Pubs extracted from the earliest surviving records. The planet file from 1st May 2006 http://planet.openstreetmap.org/cc-by-sa/planet-060501-FromLA2.osm.bz2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harry-wood
harry-wood / lunch-options.geojson
Last active August 29, 2015 14:05
Lunch options according to Harry
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harry-wood
harry-wood / adiumirc2mediawiki.php
Created September 20, 2014 15:28
Converts text copied out of adium IRC, into mediawiki syntax suitable for pasting into a wiki as minutes of a meeting. Use it here: http://harrywood.dev.openstreetmap.org/adiumirc2mediawiki.php
<?php
/**
* Converts text copied out of adium IRC, into mediawiki syntax
* suitable for pasting into a wiki as minutes of a meeting
*/
header('Content-Type: text/html; charset=utf-8');
?>
<html>
<head>
<title>adium IRC to MediaWiki formatting converter</title>
@harry-wood
harry-wood / restaurants-goswell-rd.geojson
Last active August 29, 2015 14:10
Some restaurants around Goswell Rd area. For seating 20 ...possibly quiet
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harry-wood
harry-wood / changesets2csv.rb
Created November 30, 2014 02:16
Converts a changesets.osm file (experimental planet download) into a CSV file
# Converts a changesets.osm file (experimental planet download) into a CSV file.
#
# Supply filename or stream as parameter
# Output is written to changesets.csv (example lines reported to std out)
#
# To load the result into postgres:
# CREATE TABLE changesets (uid BIGINT, created TIMESTAMP, min_lat FLOAT, max_lat FLOAT, min_lon FLOAT, max_lon FLOAT, changes INTEGER);
# COPY changesets FROM '/vagrant/changesets.csv' DELIMITER ',' CSV;
#
# then you can do fun queries like this user ranking
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harry-wood
harry-wood / Vagrantfile for jekyll
Last active January 3, 2017 15:58
Vagrantfile for jekyll (ruby2 rbenv bundle-installed project)
Vagrant::Config.run do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.forward_port 4000, 4000
$script = <<-SCRIPT
set -o verbose
set -e
whoami
@harry-wood
harry-wood / random_kml.rb
Created October 16, 2017 00:35
Little ruby script to generate a test KML file, with 40 random markers
puts '<?xml version="1.0" encoding="UTF-8"?>'
puts '<kml xmlns="http://www.opengis.net/kml/2.2">'
puts '<Document>'
puts " <name>Lots of placemarks #{random_str}</name>"
puts ' <description>A test KML file with lots of placemarks</description>'
(0..40).each do
puts '<Placemark>'
puts " <name>placemark name #{random_str}</name>"
puts " <description>#{random_str}#{random_str}#{random_str}</description>"
@harry-wood
harry-wood / holidays.rb
Created December 5, 2017 12:14
That thing when you write a ruby script to calculate holiday days :-)
require 'date'
DAY_NAMES = %w[Sun Mon Tue Wed Thu Fri Sat].freeze
BANK_HOLIDAYS = [
Date.new(2017, 1, 2),
Date.new(2017, 4, 14),
Date.new(2017, 4, 17),
Date.new(2017, 5, 1),
Date.new(2017, 5, 29),