This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fetch & parse leap-seconds.list | |
from datetime import datetime, timezone, timedelta | |
from hashlib import sha1 | |
import requests | |
# Leap second data source | |
# url = 'https://www.ietf.org/timezones/data/leap-seconds.list' | |
url = 'https://raw.githubusercontent.com/eggert/tz/main/leap-seconds.list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
''' Demo of the Fenwick tree, aka Binary Indexed Tree | |
See https://en.wikipedia.org/wiki/Fenwick_tree | |
Converted from C to Python by PM 2Ring | |
''' | |
def LSB(i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' algorithmx_spotit | |
Generate small Spot-It decks by brute force searching for | |
the exact cover of pairs of cards which share a symbol. | |
Uses Knuth's Algorithm X for the exact cover problem. | |
The Algorithm X code, using dicts instead of doubly-linked | |
circular lists was written by Ali Assaf. |