Skip to content

Instantly share code, notes, and snippets.

@Jonty
Jonty / eb_analyse.py
Created March 18, 2020 18:20
Grab autoscaling settings for all elastic beanstalk applications and environments
import boto3
eb = boto3.client("elasticbeanstalk")
asg = boto3.client("autoscaling")
response = eb.describe_environments()
instances = 0
for env in response["Environments"]:
resources = eb.describe_environment_resources(
@Jonty
Jonty / uk_gov_websites_archive.md
Last active July 28, 2020 20:02
The earliest Archive.org snapshot of every UK Government domain

Recently @alexparsons asked Democracy Club what the earliest local authority website was. Nobody knew, but we had fun looking at pages from 1996.

I pulled up my old IPv4 reverse DNS scan of .gov.uk domains, and the official list of .gov.uk domains, then queried the internet archive for each one.

The list below is every UK Government website sorted by the first time the Internet Archive saved a copy.

The links go to the archived version of the site at that time. Expect to get nostalgic. - @jonty

Archive date Domain
{
"data": {
"attributes": {
"action": "Allow the Red Arrows to Fly at the 2012 Olympics.",
"background": "The Department of Culture, Media and Sport have deemed the RAF Red Arrows as Unsuitable for the 2012 Olympics because they are too British.\n\nThis is a ridiculous decision and should be overturned in the name of common sense.",
"closed_at": "2008-09-17T00:00:00Z",
"creator_name": "Mark Standley",
"government_response_at": "2008-09-18T00:00:00Z",
"government_responses": [
{
import asyncio
from pyppeteer.launcher import launch
async def to_pdf(browser, url):
page = await browser.newPage()
await page.goto(url)
pdf = await page.pdf()
with open('emfcamp.pdf', 'wb') as f:
f.write(pdf)
@Jonty
Jonty / mogg_words.txt
Created July 5, 2017 10:35
Frequency count of words used by rees-mogg
9157 is
8795 and
8794 a
7280 it
7214 in
6394 i
4848 be
4642 not
4414 we
4382 for
@Jonty
Jonty / hansard_rees_mogg.tsv
Created July 5, 2017 10:25
Everything Jacob Rees-Mogg has said in parliament. The shit.
We can't make this file beautiful and searchable because it's too large.
Will my right hon. Friend be asking businesses to list the most egregious and restrictive EU directives that may be removed once we leave in order to make British business more competitive and efficient? https://www.theyworkforyou.com/debates/?id=2017-06-27a.441.0&s=speaker%3A24926#g442.3
Does the Prime Minister agree that no reasonable person could oppose what she has proposed? The only people who do never wanted us to leave in the first place. The idea that a foreign court should rule on the rights of people living here is akin to the outdated colonial approach taken towards China in the unequal treaties of the 19th century. https://www.theyworkforyou.com/debates/?id=2017-06-26a.300.0&s=speaker%3A24926#g314.0
Thank you, Mr Speaker.At the end of her compassionate and comprehensive statement, my right hon. Friend the Prime Minister said that we had to think about the people living very different lives from ourselves. As I am sure she knows, in opinion surveys going back over decades people never said
@Jonty
Jonty / pre_compile
Created February 6, 2017 14:26
Workaround to install geo deps on cloudfoundry. Place in `bin/pre_compile` in the root of the app.
#!/bin/bash
VENDORED_GDAL="https://lang-python.s3.amazonaws.com/cedar-14/libraries/vendor/gdal.tar.gz"
VENDORED_GEOS="https://lang-python.s3.amazonaws.com/cedar-14/libraries/vendor/geos.tar.gz"
VENDORED_PROJ="https://lang-python.s3.amazonaws.com/cedar-14/libraries/vendor/proj.tar.gz"
mkdir -p .heroku/vendor
echo "Grabbing gdal..."
curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor
echo "Grabbing geos..."
@Jonty
Jonty / bercow.tsv
Created January 31, 2017 16:26
Everything John Bercow has ever said in Parliament. A TSV with a link to where/when it was said.
We can't make this file beautiful and searchable because it's too large.
For the record, that was passed unanimously. https://www.theyworkforyou.com/debates/?id=2017-01-30a.705.0&s=speaker%3A10040#g751.0
I call the Front Bench speakers to wind up. If each could take no more than 10 minutes, or thereabouts, that would be excellent. https://www.theyworkforyou.com/debates/?id=2017-01-30a.705.0&s=speaker%3A10040#g742.1
That was a splendid example, to be followed. It is not for me to comment on the content of the hon. Lady’s speech, but the length was admirable. https://www.theyworkforyou.com/debates/?id=2017-01-30a.705.0&s=speaker%3A10040#g733.0
Order. There are—four, five, six—nine Members wishing to speak. Let me explain to the House that each of the Front-Bench speakers should have an opportunity to speak for 10 minutes or thereabouts, and the Minister should conclude by 8.59 pm, because the right hon. Member for Doncaster North (Edward Miliband) has the right to reply at that point. We must work on that basis. If everyone speaks for three or four minutes, we shall be f