Skip to content

Instantly share code, notes, and snippets.

View mattstibbs's full-sized avatar

Matt Stibbs mattstibbs

  • Digi-M Ltd
  • Kent, UK
View GitHub Profile
@mattstibbs
mattstibbs / Duplicacy pre-backup script
Last active December 29, 2022 20:48
A pre-backup script for using with Duplicacy backups
#!/bin/bash
# Gather current power status
AC_POWER=`ioreg -l | grep ExternalConnected | cut -d"=" -f2 | sed -e 's/ //g'`
# Gather details about current wifi network
WIFI_NETWORK=`networksetup -getairportnetwork en0 | grep 'Current Wi-Fi Network' | cut -c 24-`
# Specify the name of your home / office wifi network here
HOME_WIFI=my_home_wifi
@mattstibbs
mattstibbs / validate_nhs_number.py
Last active January 7, 2022 14:51
Validates a given NHS number to ensure it is valid according to the specification
"""
This code checks that an NHS number is of valid format based on the specified calculation and check digit.
It does NOT check that the NHS number is an active, valid NHS number according to the national NHS number database.
Requires: Python 3.6+
"""
# NHS numbers must be ten numerical digits long
nhs_number = "1354554531"