Skip to content

Instantly share code, notes, and snippets.

View ed-davies's full-sized avatar

Ed Davies ed-davies

View GitHub Profile
@ed-davies
ed-davies / infundibulum.py
Created September 30, 2024 18:33
Python program to download product and price information from the Octopus API
#!/usr/bin/env python3
# infundibulum.py
"""
Download data from the Octopus Energy API and store it in the mqttrunner
database.
Infundibulum is the Latin for funnel. It's used in various contexts in biology
including for the outer part of the suckers on an octopus's arms.
#!/usr/bin/python3
# snapshot
"""
Backup a set of directories on to a new sub-directory of a specified
destination directory, hard linking files which are duplicates of files
with the same path and contents in a previous such backup.
"""
#!/bin/bash
set -e
STAMP=$(date "+%Y-%m-%dT%H:%M:%S")
DEST=/media/ed/hitachi
MACHINE=$(uname -n)
TARGET=$DEST/$MACHINE
[ -d $TARGET ] || (
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
import sys
import serial
import threading
import Queue
import datetime
import xml.dom
import xml.dom.minidom
@ed-davies
ed-davies / version
Created May 9, 2014 11:33
wget without SNI
edavies@bill:~$ wget --version
GNU Wget 1.13.4 built on linux-gnu.
+digest +https +ipv6 +iri +large-file +nls +ntlm +opie +ssl/openssl
Wgetrc:
/etc/wgetrc (system)
Locale: /usr/share/locale
Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
-DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib
@ed-davies
ed-davies / thermal-mass.py
Last active January 3, 2016 17:49
Quick-and-dirty simulation of the effect of thermal mass on a cartoon house's heating requirements.
#!/usr/bin/env python3
import math
# Constants to reference times of day in seconds conveniently.
MINUTES = 60
HOURS = 60 * MINUTES
DAYS = 24 * HOURS
# House dimensions (in metres) and similar parameters.