Skip to content

Instantly share code, notes, and snippets.

@Jonty
Jonty / open_house_london_api.md
Last active March 4, 2024 01:40
Open House London API (Or any open-city.org.uk city)
@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
#!/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

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 / 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
# 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_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 / gist:263b7d5a637fc4f22dcfcdee6fd53b9a
Created May 26, 2021 01:01
Freenode server sponsors on 26th May 2021
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
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
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 / 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
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"]