Skip to content

Instantly share code, notes, and snippets.

@andylolz
andylolz / london_postcodes.py
Last active August 29, 2015 13:56
Generate KML for London postcode regions using coordinate data scraped from free-postcode-maps.co.uk
import string
import time
import urllib2
'''
Generate KML for London postcode regions
'''
url_base = 'http://www.free-postcode-maps.co.uk/_polygons/'
@andylolz
andylolz / gist:e351b3d8313f63d437ae
Created September 5, 2014 11:53
Thanks for attending the Code Club London meetup

To all that attended the Code Club meetup last night,

Thanks so so much for coming along! It was ace to meet with and chat to so many of you. (If you couldn’t make it: next time!)

Of course volunteering to run a club has its own rewards, but it’s still always lovely to meet with other volunteers and potential volunteers, discuss shared experiences, and of course to say thank you and well done to one another in person :) I feel lucky to be part of such a great community.

If, following discussion, you do have some great ideas for how Code Club can be improved (or some great experiences you’d like to share), you can always tweet @CodeClub or get in touch with the dedicated 24-hours-a-day, 7-days-a-week Volunteer Support Team: support@codeclub.org.uk (that’s a joke! the Code Club team is teeny-tiny. But I know they love hearing from their volunteers.)

As you may have noticed, the amount of meetup organisation required was small, and could even have been smaller! E.g.

@andylolz
andylolz / gist:505b488aaf1af9635fe8
Last active August 29, 2015 14:13
Add to YourNextMP all of the Labour MPs confirmed as standing
import requests
import json
import time
import re
###############################################
## ##
## Add to YourNextMP all of the Labour MPs ##
## confirmed as standing ##
@andylolz
andylolz / gist:1963c995fe93af330714
Created January 19, 2015 13:48
Bodge to check Lib Dem data in YNMP isn’t completely bonkers
import json
import requests
import time
url = 'http://yournextmp.popit.mysociety.org/api/v0.1/search/persons?q=party:%%27Liberal%%20Democrats%%27&page=%d'
has_more = True
page = 0
results = []
@andylolz
andylolz / output.md
Last active August 29, 2015 14:14
Find MP twitter accounts on Tweetminster; check if they're present on YourNextMP
from bs4 import BeautifulSoup
import requests
import time
import json
import re
#############################################
# #
# Find MP twitter accounts on Tweetminster; #
# check if they're present on YourNextMP #
@andylolz
andylolz / gist:61be99425dd3caf3d7ad
Created February 2, 2015 12:54
Hacky YNMP script to find Green Party candidates in Scotland
import time
import requests
'''
Check for Green Party candidates in Scotland (they are probably
supposed to be Scottish Green Party candidates)
'''
r = requests.get('http://mapit.mysociety.org/areas/WMC')
@andylolz
andylolz / gist:625f479dd5bed9ce2d08
Created February 4, 2015 09:53
Incomplete… A start at a twitter list scraper for UKIP candidates
#!/usr/bin/env python
import requests
import twitter
from common import get_empty_json_directory, write_ppc_json
twitter_handle = 'Vote_UKIP'
list_name = 'ukip-ppcs-3'
@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 = '######'
@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)
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%