Skip to content

Instantly share code, notes, and snippets.

View harrybiddle's full-sized avatar

Harry Biddle harrybiddle

View GitHub Profile
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Trase Website Metadata",
"description": "",
"type": "object",
"properties": {
"name": {},
"contexts": {
"type": "array",
@harrybiddle
harrybiddle / test.yml
Created September 5, 2020 08:10
Skip GitHub Actions for Draft PRs
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
jobs:
build:
if: github.event.pull_request.draft == false
@harrybiddle
harrybiddle / etag_matches_buffer.py
Last active January 14, 2022 15:22
Compute an AWS S3 ETag locally and check if it matches the remote object
"""
This script fetches the ETag of an AWS S3 object. It then computes
the ETag locally to see if it matches.
From From https://teppen.io/2018/10/23/aws_s3_verify_etags/
"""
from typing import Optional
from hashlib import md5
@harrybiddle
harrybiddle / iterables_equal.py
Last active December 17, 2019 20:44
Equality of nested iterables
from collections import Counter
def iterables_equal(a, b):
"""
Returns true if and only if two iterables of hashable objects are equal up to their
order. Iterables can be nested.
For example:
iterable_equality([1, 2], [2, 1]) # True
@harrybiddle
harrybiddle / timediff.py
Last active October 12, 2017 14:56
Simple Python script for computing differences between times
#! /usr/bin/env python3
import argparse
import sys
from dateutil import parser as date_parser
from datetime import datetime
INTERVALS = (('years', 60 * 60 * 24 * 7 * 52),
('weeks', 60 * 60 * 24 * 7),