Skip to content

Instantly share code, notes, and snippets.

View hornc's full-sized avatar
👾
🎼

Charles Horn hornc

👾
🎼
  • Wellington, New Zealand
View GitHub Profile
@hornc
hornc / isbnregions.sh
Created November 30, 2021 01:42
Takes an input list of ISBN13s and counts how many belong to each of the possible regional agencies.
#!/bin/bash
# Takes an input file argument (a sorted list of ISBN13s)
# and counts how many ISBNs are present belonging to each
# regional agency as listed in the official
# ISBN export_rangemessage.xml data.
wget -nc https://www.isbn-international.org/export_rangemessage.xml
while read prefix agency; do
@hornc
hornc / move_editions.py
Last active January 31, 2023 01:34
Move OL editions to correct Work
from olclient.openlibrary import OpenLibrary
ol = OpenLibrary()
def move_editions(editions, master):
"""Sets a list of <editions> to a new master work ID using the Open Library Client.
Copies across extra author data from editions to master, if not already present.
Example:
move_editions(['OL8306567M','OL16682544M'], 'OL4005510W')
"""
@balasankarc
balasankarc / odftest
Last active January 29, 2024 17:19
Basic stuff with odfpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from odf.opendocument import OpenDocumentText
from odf.style import (Style, TextProperties, ParagraphProperties,
ListLevelProperties, TabStop, TabStops)
from odf.text import (H, P, List, ListItem, ListStyle, ListLevelStyleNumber,
ListLevelStyleBullet)
from odf import teletype