This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uk_planning_scraper' | |
require 'csv' | |
apps = UKPlanningScraper::Authority.named('Aberdeen').scrape({ validated_days: 200, keywords: 'bt phone kiosk'}) | |
puts "#{apps.size} applications scraped." | |
CSV.open("aberdeen.csv", "w") do |csv| | |
csv << apps.first.keys # header row | |
apps.each { |app| csv << app.values } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Download PDF files for a planning application from Sutton Council planning website | |
# If you run this more than once it'll only download the new files uploaded for that application. | |
# Usage: $ get.sh <application number>, e.g. $ get.sh B2015/71962 | |
# Install curl and wget before use. Mac users can install them with Homebrew. | |
# Windows users: Try running this in Cygwin or install Linux in a virtual machine. | |
# Adrian Short 26 Feb 2016 | |
COOKIEJAR=cookiejar.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert Jekyll blog posts to DokuWiki pages | |
# Adrian Short (https://adrianshort.org/) 15 Feb 2015 | |
require 'fileutils' | |
require 'yaml' | |
require 'pp' | |
require 'pandoc-ruby' | |
INPUT_DIR = "./_posts" | |
OUTPUT_BASEDIR = "./blog" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
====== @!!PAGE@ ====== | |
**@!!PAGE@** is | |
===== External links ===== | |
* [[http://www.example.com/|Official website]] | |
* [[wp>@!!PAGE@]] | |
{{tag>tag1 tag2 "tag3 with spaces"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# D'Hondt method calculations | |
# https://en.wikipedia.org/wiki/D'Hondt_method | |
# By Adrian Short (@adrianshort) 26 May 2014 | |
# European Parliament election, London region, 22 May 2014 | |
@parties = { | |
'4 Freedoms Party (UK EPP)' => 28014, | |
'An Independence from Europe' => 26675, | |
'Animal Welfare Party' => 21092, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'pp' | |
require 'erb' | |
require 'time' | |
# https://gist.github.com/adrianshort/5547284 | |
# $ ruby csv2georss.rb myfile.csv > feed.xml | |
template = ERB.new <<-EOF | |
<?xml version="1.0" encoding="UTF-8" ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scrape webpage into a podcast RSS feed | |
# https://www.sutton.gov.uk/index.aspx?articleid=4332 | |
require 'nokogiri' | |
require 'open-uri' | |
require 'time' | |
require 'pp' | |
FEED_TITLE = "Cheam North and Worcester Park Local Committee" | |
FEED_IMAGE = "https://dl.dropbox.com/u/300783/logo.png" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract URLs from a web page to a CSV file | |
# $ python extract-urls.py http://mysite.com/mypage.html myfile.csv | |
# By Adrian Short 6 Sep 2012 | |
import sys | |
import urllib | |
import csv | |
from bs4 import BeautifulSoup | |
url = sys.argv.pop(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem install bson_ext | |
Building native extensions. This could take a while... | |
ERROR: Error installing bson_ext: | |
ERROR: Failed to build gem native extension. | |
/Users/adrian/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb | |
checking for asprintf()... *** extconf.rb failed *** | |
Could not create Makefile due to some reason, probably lack of | |
necessary libraries and/or headers. Check the mkmf.log file for more | |
details. You may need configuration options. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
include MongoMapper::Document | |
key :title, String | |
key :url, String | |
key :author, String | |
key :summary, String | |
key :content, String | |
key :published, Time | |
key :loc, Hash # { lng, lat } |
NewerOlder