Skip to content

Instantly share code, notes, and snippets.

View MattHealy's full-sized avatar

Matt Healy MattHealy

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jsPDF Example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js"></script>
</head>
<body>
<button id="generatePDF">Generate PDF</button>
import boto3
import csv
import calendar
from datetime import date, datetime, timedelta
from collections import OrderedDict
client = boto3.client('apigateway')
endDate = date(year=2023, month=3, day=31)
import boto3
import csv
client = boto3.client('route53domains', region_name='us-east-1')
fieldnames = [
'Domain Name',
'Domain Registrar',
'Expiration Date',
'Auto-Renewal',
import boto3
import csv
client = boto3.client('ec2')
regions = [region['RegionName'] for region in client.describe_regions()['Regions']]
fieldnames = [
'Certificate',
'Common Name',
import boto3
from datetime import date, timedelta
endDate = date.today()
startDate = endDate - timedelta(days=7)
tempDate = startDate
days = []
while tempDate <= endDate:
days.append(tempDate)
@MattHealy
MattHealy / remote-login.sh
Created January 12, 2022 01:40
Get IP address and SSH
#!/bin/bash
ADDRESS=`aws ec2 describe-instances --filters 'Name=tag:Name,Values=WebServer' --output text --query 'Reservations[*].Instances[*].PrivateIpAddress'`
ssh ec2-user@$ADDRESS
@MattHealy
MattHealy / sign.php
Created June 30, 2021 11:54
PHP HMAC-SHA512 example
<?php
// HMAC-SHA512 signing
function get_signature($event, $orderid, $listing_id) {
// Hashing algorithm to use
$algo = 'sha512';
// Shared key used for signing payloads
@MattHealy
MattHealy / .bashrc
Created January 17, 2021 12:09
bashrc vpn switcher
vpn() {
# Usage: "vpn uk" to connect to UK VPN
# Usage: "vpn" to connect to AU VPN
REGION="${1:-au}"
sudo killall openvpn
if [ $REGION == "uk" ]; then
sudo openvpn --daemon --config ~/ovpn/vaultre-uk-matthealy.ovpn
else
sudo openvpn --daemon --config ~/ovpn/vaultre-matthealy.ovpn
fi
@MattHealy
MattHealy / amazon-s3-put.pl
Created July 7, 2020 11:51
PUT a large file directly to Amazon S3
#!/usr/bin/perl
use File::Slurp; # not strictly needed, but nice to have
use Data::Dumper;
use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;
my $key = '';
my $token = '';
@MattHealy
MattHealy / watchAmazon.sh
Last active December 11, 2019 23:29
Watch an amazon product price
watch -n 60 "curl -s \
--url 'https://www.amazon.com.au/Thermos-THERMOcafe-Vacuum-Insulated-BOL750R6AUS/dp/B07DHGBNM9' \
--compressed | grep 'priceblock_ourprice' | grep 'priceBlockBuyingPriceString' >> /tmp/amazon.log"