Skip to content

Instantly share code, notes, and snippets.

@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: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 / 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: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 / 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:717626137848f2e185f9
Last active March 14, 2018 19:22
Code Club Dev: Automating Project Builds

Code Club Dev: Automating Project Builds

Disclaimer: I don’t work for Code Club; I’m a volunteer. Also: I don’t blog.

Rationale

I’ve been doing a fair bit of work on the Code Club lesson formatter lately. That’s the tool used to turn source markdown, resources and json into a static website of Code Club projects (UK; World).

Felix and Herbert project

@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 / 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 / demo.py
Last active January 2, 2016 13:49
Python module for solving assignment problems: http://en.wikipedia.org/wiki/Assignment_problem
import election_data
from match import match
'''
Match BBC constituency names with TheyWorkForYou constituency names,
using MP name and party as extra queues
'''
twfy_data = election_data.get_twfy_data()
twfy_fields = ('party', 'name', 'constituency')
@andylolz
andylolz / assange.xml
Last active May 6, 2019 06:24
Parse the wikileaks transcript of a meeting between Julian Assange and Eric Schmidt into the Akoma Ntoso format, in order to import it into SayIt (https://github.com/mysociety/sayit)
<akomaNtoso>
<debate name="Transcript of secret meeting between Julian Assange and Google CEO Eric Schmidt">
<meta>
<references source="#">
<TLCPerson id="SC" href="/ontology/person/SC" showAs="Scott Malcomson" />
<TLCPerson id="JC" href="/ontology/person/JC" showAs="Jared Cohen" />
<TLCPerson id="JA" href="/ontology/person/JA" showAs="Julian Assange" />