Skip to content

Instantly share code, notes, and snippets.

@andylolz
andylolz / calc.py
Last active January 30, 2017 16:47
import csv
import requests
json = requests.get('https://petition.parliament.uk/petitions/171928.json').json()
petition = json['data']['attributes']['signatures_by_constituency']
with open('electorate.tsv') as f:
r = csv.DictReader(f, delimiter='\t')
constituencies = [x for x in r]
@andylolz
andylolz / 2016_numbers.md
Last active December 3, 2015 14:56
How many candidates are standing in UK elections in 2016?

2016 Elections – Candidate lists

One Democracy Club (DC) plan for 2016 is to create candidate lists for all 2016 UK elections (much like we did for the 2015 general election (GE2015) with https://yournextmp.com). Last night @ Citizen Beta (Cß), Mark Longair rightly flagged that this is quite (very) ambitious! I realised I have no handle on just how ambitious i.e. how many candidates we’re talking.

The Electoral Commission have a list of upcoming elections: http://www.electoralcommission.org.uk/find-information-by-subject/elections-and-referendums/upcoming-elections-and-referendums

Below are the numbers I’ve found so far for each.

Northern Ireland Assembly election

@andylolz
andylolz / gist:e1cbf97e996910e524be
Created April 21, 2015 16:52
Westminster constituency data, including example postcodes
{
"65642": {
"codes": {
"gss": "E14000847",
"unit_id": "24722"
},
"name": "North Herefordshire",
"country": "E",
"type_name": "UK Parliament constituency",
"example_postcode": "HR7 4LX",
@andylolz
andylolz / gist:976690ee36f081b1f504
Created April 10, 2015 09:39
Have submitted CVs
1930-06-21 Gerald Kaufman
1933-06-26 David Winnick
1943-08-20 Roger Gale
1944-09-08 Margaret Hodge
1945-11-14 Louise Ellman
1952-02-01 Andrew Smith
1952-03-22 David Jones
1952-04-04 Jim Fitzpatrick
1953-01-11 Graham Allen
1953-07-24 Julian Brazier

Keybase proof

I hereby claim:

  • I am andylolz on github.
  • I am andylolz (https://keybase.io/andylolz) on keybase.
  • I have a public key whose fingerprint is 8B21 BF74 E3E1 21AB 4D5D A33B 43A3 BB6E 4CB8 8509

To claim this, I am signing this object:

{
"NiaGriffithMP": 481120639,
"StewartHosieMP": 219298196,
"MichaelMcCannMP": 397229449,
"GWilliamsonMP": 368314502,
"JohnHowellMP": 993161678,
"tomgreatrexmp": 198912426,
"PatGlassMP": 118429508,
"NickBolesMP": 1548391070,
"jarrowstevemp": 2808847414,
#!/usr/bin/env python
import base64
import os
import sys
import webbrowser
import hashlib
import hmac
Party Selected Women % Women
Conservative 57 9 15.8%
Labour 58 16 27.6%
Lib Dems 54 14 25.9%
SNP 59 21 35.6%
Greens 31 13 41.9%
@andylolz
andylolz / gist:8dba04a31ea06f4ab946
Last active August 29, 2015 14:16
MPs not standing for re-election in 2015. (The year of each MP’s earliest parliamentary membership is also shown)
@andylolz
andylolz / gist:0839a5e245d2e38512a4
Created February 8, 2015 17:55
Interactive tool for finding missinging YNMP twitter handles
import time
import requests
import twitter
import re
from bs4 import BeautifulSoup
consumer_key = '######'
consumer_secret = '######'
access_token = '######'