Skip to content

Instantly share code, notes, and snippets.

@Jonty
Jonty / deredactatron.py
Last active October 10, 2023 20:39
The Deredactatron: De-redacts PDF's redacted by drawing rectangles over the text. Needs Python3 and PyMuPDF
View deredactatron.py
#!/usr/bin/env python3
# De-redacts PDF's that have been redacted by drawing PDF-native rectangles over the text
# This removes ALL rectangles so might also nuke any shape diagrams a bit
# python deredactatron.py a_redacted_doc.pdf
# Outputs: deredacted-a_redacted_doc.pdf
import sys
import re
@Jonty
Jonty / remaining_museum_domains.md
Last active November 24, 2022 18:38
Every remaining website using the .museum TLD
View remaining_museum_domains.md

Every remaining website using the .museum TLD

The .museum TLD was created by the International Council of Museums (ICOM) in 2001 and is managed by The Museum Domain Management Association (MuseDoma). At the beginning the Museum Domain Management Association was shortened to its initials (MDMA) until the management team was advised to change it.

Anyone "of a nature to serve the interests of the world museum community" can register a .museum name. Each domain costs €35/year.

Over 1000 museum domains have been registered at both the second and third level, but at the time of writing in 2021 almost all are either defunct or redirect to another domain.

Below are the only remaining .museum websites using the TLD for their primary domain. This list was obtained by checking all 1134 domains listed on index.museum.

@Jonty
Jonty / gist:263b7d5a637fc4f22dcfcdee6fd53b9a
Created May 26, 2021 01:01
Freenode server sponsors on 26th May 2021
View gist:263b7d5a637fc4f22dcfcdee6fd53b9a
Linkname
Hostname
Port SSL Date Time
card.freenode.net
chat.freenode.net
6697 on May 26 00:00
tildes.freenode.net
chat.freenode.net
6667 off May 25 22:00
View List_of_councils_in_England_by_type_2019.csv
Type Name
metropolitan_district Barnsley Borough Council
metropolitan_district Birmingham City Council
metropolitan_district Bolton Borough Council
metropolitan_district Bradford City Council
metropolitan_district Bury Borough Council
metropolitan_district Calderdale Borough Council
metropolitan_district Coventry City Council
metropolitan_district Doncaster Borough Council
metropolitan_district Dudley Borough Council
View tower_of_london_raven_costs.csv
Year Food, Vets & Ancillary Costs Staffing Total
2015 4,301.83 31,310.00 35,611.83
2016 3,694.56 32,093.00 35,787.56
2017 4,508.96 32,895.00 37,403.96
2018 8,084.32 33,717.00 41,801.32
2019 7,828.90 34,560.00 42,388.90
@Jonty
Jonty / extract_code_from_doxygen.py
Created December 28, 2020 19:11
Extract all code from a set of Doxygen generated documentation, for use when recovering code that has otherwise been lost
View extract_code_from_doxygen.py
# This extracts all the code from a set of Doxygen generated documentation
# where the code is embedded and highlighted. You really only need to use this
# when attempting to recover lost code and you still have the docs.
# Writes all code out into the original directory structure relative to where
# the script is executed.
# Run: `python extract_code_from_doxygen.py URL_TO_DOXYGEN_FILES_PAGE`
# e.g. `python extract_code_from_doxygen.py http://swf2svg.sourceforge.net/azar/doc/files.html`
@Jonty
Jonty / eb_dump_env_vars.py
Created December 17, 2020 00:18
Dump environment variables for all Elastic Beanstalk apps in an AWS account, redacting passwords/secrets/keys/tokens
View eb_dump_env_vars.py
import boto3
client = boto3.client("elasticbeanstalk")
apps = client.describe_applications()
for app in apps["Applications"]:
envs = client.describe_environments(ApplicationName=app["ApplicationName"])
for env in envs["Environments"]:
env_name = env["EnvironmentName"]
@Jonty
Jonty / open_house_london_api.md
Last active September 11, 2020 14:35
Open House London API (Or any open-city.org.uk city)
View open_house_london_api.md
@Jonty
Jonty / pipecleaner.py
Created August 12, 2020 20:09
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 / split_svg_paths.py
Last active September 16, 2020 14:15
An extremely hacky bit of code to split an SVG of joined line paths into individual lines, and merge straight lines made of smaller lines into single lines
View split_svg_paths.py
# An extremely hacky bit of code that takes SVG files output by Blender
# and splits all the multi-node line paths into single line paths to make
# editing easier. Example: A right-angle path is now two lines that meet.
#
# Blender has a habit of outputting really _weird_ paths that are annoying
# to edit on geometric shapes, and also outputs straight lines that are
# made up of many smaller straight line nodes. This code also merges those
# mini-line lines into single lines to stop you throwing your computer out
# of the window when you try and work with the SVG.
#