Skip to content

Instantly share code, notes, and snippets.

@jhmartin
jhmartin / gist:10bda5504eedab4cd182031408834f30
Created August 28, 2025 19:28
Cloudfront force no-cache on request
-H "Cache-Control: cf-no-cache" \
@jhmartin
jhmartin / gist:61d12082777b0f919142214957f1f77a
Created August 26, 2025 17:48
Get EC2 baseline bandwidth
function ec2bw_func() {
aws ec2 describe-instance-types --filters "Name=instance-type,Values=$1.*" --query "InstanceTypes[].[InstanceType, NetworkInfo.NetworkPerformance, NetworkInfo.NetworkCards[0].BaselineBandwidthInGbps] | sort_by(@,&[2])" --output table
}
alias ec2bw=ec2bw_func
@jhmartin
jhmartin / curl-format.txt
Created August 19, 2025 16:22
curl timing
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
### Keybase proof
I hereby claim:
* I am jhmartin on github.
* I am toger (https://keybase.io/toger) on keybase.
* I have a public key whose fingerprint is 4480 9BA8 6D1F EFE1 098E 1E54 D7C1 D3B7 0BFB 684B
To claim this, I am signing this object:
@jhmartin
jhmartin / fan_temperature_sync.py
Created June 22, 2025 15:55
Read status from an Airscape Gen2 Controls whole-home-fan and emit into openhab
#!/usr/bin/env python3
import requests
import json
import re
import time
import signal
import sys
import logging
import http.client as http_client
@jhmartin
jhmartin / gist:77c865294e4fe620b2070e9ffef23633
Created June 17, 2025 03:29
FranklinWH aGate DNS queries
a6f63crce3ufk-ats.iot.us-east-2.amazonaws.com. A
a6f63crce3ufk-ats.iot.us-east-2.amazonaws.com. AAAA
fwh.wceui.top. A
fwh.wceui.top. AAAA
open-api.franklinwh.com. A
open-api.franklinwh.com. AAAA
@jhmartin
jhmartin / dnsfailover.tcl
Last active January 8, 2025 17:26
Mikrotik DNS failover
:global testDomain "dnstest.local" ;# Domain to test DNS resolution
:global queryServer "192.168.1.29" ;# Specific DNS server to query, local AdGuard instance
:global successDNS "192.168.1.29" ;# DNS server if the DNS request is successful, local AdGuard instance
:global failureDNS "9.9.9.11" ;# DNS server if the DNS request fails,
:log info "Testing DNS resolution for $testDomain using $queryServer."
# Perform a DNS lookup using a specific server
:do {:resolve domain-name="dnstest.local" server=$queryServer; /ip dns set servers=$successDNS; } on-error={/ip dns set servers=$failureDNS;}
@jhmartin
jhmartin / upgrade.js
Created December 19, 2024 21:10 — forked from quonic/upgrade.js
Birburner Hacknet Node upgrade script. I found and converted this script from .script to .js.
const MoneyFormat = '$0.0a';
const TimeFormat = '00:00:00';
/** @param {import(".").NS } ns */
export async function main(ns) {
/*
ns.hacknet-auto.script for Bitburner v0.47.2
Winners don't use copyright
@jhmartin
jhmartin / gist:92743b2010df38924f19a9b07b1b6953
Created December 21, 2023 20:05
Checking reachability in databricks
%sh nc -vz DESTINATIONHOST 6379
4WD 1 - 146.430
4WD 2 - 146.460
4WD 3 - 146.490
4WD 4 - 146.580
4WD 5 - 147.420
4WD 6 - 147.450
4WD 7 - 147.480
4WD 8 - 147.540
4WD 9 - 147.570