Skip to content

Instantly share code, notes, and snippets.

View njh's full-sized avatar

Nicholas Humfrey njh

View GitHub Profile
@njh
njh / check-hsbc-tracker-rate.rb
Created June 4, 2024 12:09
Script to parse the HSBC mortgage rate page
#!/usr/bin/env ruby
#
# Script to parse the HSBC mortgage rate page
# to see if they have chanegd the 2 Year Term Tracker Fee Saver
#
# Subtracts the Bank of England rate from the HSBC advertised rates
#
require 'net/http'
require 'nokogiri'
@njh
njh / start-ipv6-tcp-ppp-server.sh
Last active May 2, 2024 21:09
Start an IPv6-only PPP server, that accepts connections over TCP
#!/bin/bash
#
#
pppd='pppd'
pppd+=' debug'
pppd+=' logfd 2'
pppd+=' nodetach'
pppd+=' noauth'
pppd+=' noip'
@njh
njh / extract-daily-temperature.rb
Created January 18, 2024 09:37
Get one year of historical daily temperatures for a single location from Meteosource
#!/usr/bin/env ruby
require 'date'
require 'json'
today = Date.today
start = today - 365
(start...today).each do |date|
json = File.read("weather/#{date}.json")
data = JSON.parse(json, :symbolize_names => true)
@njh
njh / .gitignore
Created May 3, 2023 22:36
Ruby script to backup the raw data written to Emoncms
*.csv
*.gz
*.bz2
@njh
njh / RS485_Serial_Echo.ino
Created April 8, 2023 22:07
Arduino sketch to receive bytes from Serial Port 1 and print them in hex to the Serial Monitor
/*
This simple sketch receives bytes on the hardware serial port
and echos it to the Arduino Serial Monitor (over USB)
The bytes are printed out as a hexadecimal string
This sketch requires an Arduino that has a separate
serial port for the USB port - such as the Arduino Leonardo
Serial: Serial Monitor (USB)
Serial1: Hardward serial (Pins 0 and 1) connected
@njh
njh / radioplayer-radiodns-test.rb
Created March 30, 2023 15:38
RadioDNS test for Radioplayer
#!/usr/bin/env ruby
require 'radiodns'
require 'uri'
puts "Looking up FQDN for Wycombe Sound 106.6"
params = {
:freq => '10660',
:pi => 'c0a6',
@njh
njh / ppg.xml
Last active March 7, 2023 12:48
An old XML database of BBC Podcasts
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<ppg xmlns="http://bbc.co.uk/2007/7/ppg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://bbc.co.uk/2007/7/ppg http://downloads.bbc.co.uk/podcasts/ppg.xsd" version="0.1" createdDate="2007-09-27T12:30:19+01:00" modifiedDate="2015-06-02T22:15:04+01:00" ownerName="BBC" ownerEmail="feedback@bbc.co.uk">
<program xmlns="" language="en-gb" typicalDuration="PT76M" active="true" public="true" bbcFlavour="Multi Programme" region="all" wwpid="0" launchDate="2009-01-21" frequency="daily" daysLive="7" liveItems="1">
<title>606 Football Phone-in</title>
<shortTitle>606</shortTitle>
<description>The UK's biggest football phone-in, broadcast on Saturdays, Sundays and midweek on BBC Radio 5 live. Fans take part in a lively debate about the latest matches and talking points.</description>
<network id="5live" name="BBC Radio 5 live" />
<image use="itunes" url="http://www.bbc.co.uk/podcasts/assets/artwork/606.jpg" />
<link target="homepage" url="
@njh
njh / gb-level6-admins.overpassql
Created February 9, 2023 11:07
Query for all Level 6 Administrative Boundaries in the UK
/*
Query for all Level 6 Administrative Boundaries in the UK
England: Two-tier non-metropolitan counties, Metropolitan counties, Unitary authorities
Scotland: council areas
Wales: principal areas
*/
[out:json][timeout:60];
@njh
njh / helloworld-arm32.bm
Last active February 1, 2023 22:22
Linux Hello World machine code for 32-bit ARM, formatted in the binmark format
## 32-bit ARM ELF machine code
# Compile this to a binary using:
# binmark helloworld-arm32.bm > helloworld-arm32
# readelf -a ./helloworld-arm32
# chmod a+rx helloworld-arm32
# ./helloworld-arm32
## ELF File header
@njh
njh / lsusb.md
Created January 7, 2023 22:55
lsusb for Linksys Gigabit Ethernet Adapter USB3GIGV1