Skip to content

Instantly share code, notes, and snippets.


Chris Buckley cmbuckley

View GitHub Profile
View export-photos.applescript
tell application "Photos"
set folderList to name of every folder
set selectedFolders to choose from list folderList with prompt "Select folders:" with multiple selections allowed
set destination to POSIX path of (choose folder with prompt "Please select a backup location:")
repeat with f in folders
if selectedFolders contains name of f then
my exportFolder(f, destination)
end if
cmbuckley / .gitattributes
Last active Feb 25, 2021
Using gron as an external git diff driver
View .gitattributes
*.json diff=gron
cmbuckley / lockdown.json
Last active Oct 22, 2020
Match postcode to COVID lockdown key points
View lockdown.json
"E92000001": {
"country_or_area": "England",
"council": 0,
"wards": 0,
"postcodes": 0,
"full_or_partial": "F",
"key_points": "Your area is under Covid restrictions, in the Tier 1 (medium alert) category for England.",
"meeting_friends_and_family": "* You can mix socially in a group of up to six people from multiple households. This includes children and applies indoors and outdoors, including private homes. \n* Socialising in larger groups is against the law, with fines up to £6,400.\n* There are exceptions, for example if your household or support bubble is larger than six, or if someone enters your house to carry out work, registered childcare or care for a vulnerable person.\n",
cmbuckley /
Last active May 31, 2020
Check for old USERTrust intermediate certificate
# Checks a server certificate chain for old USERTrust intermediate cert,
# which will expire in May 2020.
# Possible output:
# • Error (e.g. cannot connect to host)
# • Not a Sectigo/Comodo chain (cannot find one of the CAs)
# • New USERTrust root cert found (valid, but superfluous)
cmbuckley /
Created Jan 20, 2020
Update UFW with IPs from GitHub
github=$(curl -s | jq -r '.web | .[]' | sed 's~/32~~' | sort)
ufw=$(ufw status | grep '# GitHub' | awk '{print $1}' | sort)
comm -13 <(echo "$ufw") <(echo "$github") | while read addition; do
echo "Adding $addition"
ufw allow out to $addition port 22 comment GitHub
cmbuckley / game-of-thrones-comments.php
Last active Jan 17, 2020
Get all the comments from the petition for Game of Thrones season 8
View game-of-thrones-comments.php
$base = '';
$options = ['commentable_type' => 'Event', 'commentable_id' => 15409786, 'role' => 'comment'];
$complete = false;
// API blocks PHP user-agent
$context = stream_context_create(['http' => ['header' => "User-Agent: parser/1.0.0\r\n"]]);
$fh = fopen('comments.csv', 'w');
fail() {
[ $raw -eq 1 ] && out=Fail || out=$1
echo -n -e "\e[91m$out\e[39m "
pass() {
[ $raw -eq 1 ] && out=Pass || out=$1
echo -n -e "\e[32m$out\e[39m "