Skip to content

Instantly share code, notes, and snippets.

@Jonty
Jonty / pipecleaner.py
Created Aug 12, 2020
Pipecleaner is a tool for validating concourse pipelines
View pipecleaner.py
#!/usr/bin/env python3
"""Pipecleaner is a tool for validating concourse pipelines.
Someone rewrote this in go because "it's not python 3 compatible",
so now they have a version 5x longer and less comprehensible. This
is a "port" to python3, via the 2to3 tool. It took 600ms to do.
It can check for the following issues:
* Resources being used in a job that have not been defined in the
@Jonty
Jonty / uk_gov_websites_archive.md
Last active Jul 28, 2020
The earliest Archive.org snapshot of every UK Government domain
View uk_gov_websites_archive.md

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
@Jonty
Jonty / gist:6705090
Last active Oct 29, 2018
Unicode printable character filter
View gist:6705090
def strip_string(self, string):
"""Cleans a string based on a whitelist of printable unicode categories
You can find a full list of categories here:
http://www.fileformat.info/info/unicode/category/index.htm
"""
letters = ('LC', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu')
numbers = ('Nd', 'Nl', 'No')
marks = ('Mc', 'Me', 'Mn')
punctuation = ('Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps')
@Jonty
Jonty / readtag.c
Created Oct 18, 2010
Read a single tag UID using libnfc.
View readtag.c
#include <nfc/nfc.h>
#include <nfc/nfc-messages.h>
int main ()
{
nfc_device_t *nfcDev;
nfcDev = nfc_connect(NULL);
if (nfcDev == NULL) {
printf("Cannot connect to the RFID reader.\n");
@Jonty
Jonty / bercow.tsv
Created Jan 31, 2017
Everything John Bercow has ever said in Parliament. A TSV with a link to where/when it was said.
View bercow.tsv
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&amp;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&amp;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&amp;s=speaker%3A10040#g733.0
View RedArrows2012.json
{
"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": [
{
@Jonty
Jonty / .gitconfig
Last active Jan 11, 2018
A git alias to rebase all commits added on the current branch
View .gitconfig
[alias]
rebase-branch = !git rebase -i --autosquash $(git merge-base --fork-point origin/master HEAD)
View render_pdf.py
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 Jul 5, 2017
Frequency count of words used by rees-mogg
View mogg_words.txt
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 Jul 5, 2017
Everything Jacob Rees-Mogg has said in parliament. The shit.
View hansard_rees_mogg.tsv
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&amp;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&amp;s=speaker%3A24926#g314.0