Skip to content

Instantly share code, notes, and snippets.

View jasonmadigan's full-sized avatar

Jason Madigan jasonmadigan

View GitHub Profile
#!/bin/bash
# Remember to start cloud-provider-kind first:
# sudo cloud-provider-kind --enable-lb-port-mapping=true
set -euo pipefail
command_exists() {
command -v "$1" >/dev/null 2>&1
@jasonmadigan
jasonmadigan / configuration.yaml
Created January 1, 2025 15:55
Generic Home Assistant Assist - "Add" todo list items
conversation:
intents: {}
intent_script:
ShoppingListAddItem:
action:
action: todo.add_item
target:
entity_id: todo.shopping_list
data:
@jasonmadigan
jasonmadigan / gate.yaml
Created December 12, 2024 20:44
Gate cover, no contact sensor. input_text for state
input_text:
gate_state:
name: Gate State
---
template:
cover:
- name: Gate
friendly_name: "Gate"
@jasonmadigan
jasonmadigan / kup.sh
Last active December 9, 2024 16:32
kup.sh
#!/bin/bash
# Ref: https://github.com/Kuadrant/kuadrant-operator/blob/main/doc/user-guides/full-walkthrough/secure-protect-connect-openshift.md
export PREPEND="-jmtest1"
export KUADRANT_GATEWAY_NS=api-gateway$PREPEND # Namespace for the example Gateway
export KUADRANT_GATEWAY_NAME=external$PREPEND # Name for the example Gateway
export KUADRANT_DEVELOPER_NS=toystore$PREPEND # Namespace for an example toystore app
export KUADRANT_AWS_ACCESS_KEY_ID=$KUADRANT_AWS_ACCESS_KEY_ID # AWS Key ID with access to manage the DNS Zone ID below

DCO

git commit templates only work with interactive message writing. Need a hook for -m commits.

Create a hook

cd .git/hooks
touch commit-msg
chmod +x commit-msg
@jasonmadigan
jasonmadigan / mongo_prune.js
Last active April 7, 2024 20:29
Unifi Client prune
// keep N-day worth of data
var days=7;
// change to false to have the script to really exclude old records
// from the database. While true, no change at all will be made to the DB
var dryrun=true;
var now = new Date().getTime(),
time_criteria = now - days * 86400 * 1000,
time_criteria_in_seconds = time_criteria / 1000;
@jasonmadigan
jasonmadigan / mgc-install-guide-base-setup.sh
Last active September 4, 2023 14:49 — forked from eoinfennessy/mgc-install-guide-base-setup.sh
Base setup for MGC install guide
#!/bin/bash
make local-setup-mgc
make local-setup-kind OCM_SINGLE=true
./bin/clusteradm init --bundle-version='0.11.0' --wait --context kind-mgc-control-plane
hub_token=$(./bin/clusteradm get token --context kind-mgc-control-plane -o=json | jq -r '."hub-token"')
hub_apiserver=$(./bin/clusteradm get token --context kind-mgc-control-plane -o=json | jq -r '."hub-apiserver"')
./bin/clusteradm join kind-mgc-control-plane --hub-token ${hub_token} --hub-apiserver ${hub_apiserver} --cluster-name kind-mgc-control-plane --bundle-version='0.11.0' --force-internal-endpoint-lookup --context kind-mgc-control-plane --feature-gates=RawFeedbackJsonString=true
@jasonmadigan
jasonmadigan / narwhal_hyperweb.js
Created August 11, 2023 13:41
Narwhal Hyperweb
window.location.href = `narwhal://${window.location.host}${window.location.pathname}`;
import requests
from geopy.distance import geodesic
from geopy.geocoders import Nominatim
def get_outages():
url = "https://api.esb.ie/esbn/powercheck/v1.0/outages"
headers = {"api-subscription-key": "f713e48af3a746bbb1b110ab69113960"}
response = requests.get(url, headers=headers)