Skip to content

Instantly share code, notes, and snippets.

View MattJeanes's full-sized avatar
🏳️‍🌈

Matt Jeanes MattJeanes

🏳️‍🌈
View GitHub Profile
@MattJeanes
MattJeanes / zha-hue-dimmer-switch-2nd-gen.yaml
Last active October 31, 2024 07:53
Home Assistant automation for ZHA joined 2nd gen Hue dimmer switches which are bound directly to the lights but still want to use the Hue single/double/triple/etc button presses
blueprint:
name: ZHA Hue Dimmer Switch 2nd Gen
description: Allow Hue button functionality for a directly bound 2nd gen Hue Dimmer Switch
domain: automation
input:
device_id:
name: Device
description: Hue Dimmer Switch
selector:
device:
@MattJeanes
MattJeanes / zha-hue-motion-sensor.yaml
Last active October 31, 2024 22:10
Home Assistant automation for ZHA joined Hue motion sensors to replicate the Hue app functionality
blueprint:
name: ZHA Hue Motion Sensor
description: Replicate Hue Motion Sensor functionality with ZHA
domain: automation
input:
occupancy_id:
name: Occupancy Sensor
description: Hue Motion Sensor Occupancy
selector:
entity:
@MattJeanes
MattJeanes / zha-hue-dimmer-switch-1st-gen.yaml
Last active October 31, 2024 20:54
Home Assistant automation for ZHA joined 1st gen Hue dimmer switches which are bound directly to the lights but still want to use the double/triple/etc presses
blueprint:
name: ZHA Hue Dimmer Switch 1st Gen
description: Allow extra functions for a directly bound 1st gen Hue Dimmer Switch
domain: automation
input:
device_id:
name: Device
description: Hue Dimmer Switch
selector:
device:
@MattJeanes
MattJeanes / doorbell-cast-blueprint.yaml
Last active November 20, 2023 00:26
A Home Assistant blueprint for emulating the Nest Hub doorbell notification with any sound and feed, uses WebRTC and DashCast custom components
blueprint:
name: Doorbell cast notification
description: A script that emulates the Nest Hub doorbell notification with any sound and feed
domain: script
source_url: https://gist.github.com/MattJeanes/0bb4cb11f20b327809b7e7f1d45921be
author: MattJeanes
input:
notify_device:
name: Device to notify
description: Device to cast the sound and doorbell camera to
@MattJeanes
MattJeanes / energy.yaml
Created November 15, 2023 20:00
My Home Assistant configuration for otti/Growatt_ShineWiFi-S project
# Energy
- state_topic: energy/solar
value_template: >
{% if (value_json['InverterStatus'] | int == 0) %}
Waiting
{% elif (value_json['InverterStatus'] | int == 1) %}
Normal
{% elif (value_json['InverterStatus'] | int == 2) %}
Fault
@MattJeanes
MattJeanes / JoinServer.html
Created October 12, 2023 23:08
Resolves server IP for steam connect URI
<!DOCTYPE html>
<html>
<head>
<title>Join server</title>
<style>
body {
font-family: sans-serif;
text-align: center;
}
@MattJeanes
MattJeanes / GitHubCopilotCLIAlias.ps1
Last active August 15, 2024 23:41
Alias commands to use GitHub Copilot CLI in PowerShell
# You should insert this script into your PowerShell Profile script so it exists in every session
# Fun fact: This script was mostly generated by ChatGPT by giving it the bash version of the output
# from `github-copilot-cli alias -- "$0"` with a few fixes from me
function Invoke-CopilotWhatTheShell {
$TMPFILE = New-TemporaryFile;
try {
github-copilot-cli what-the-shell $args --shellout $TMPFILE
if ($LASTEXITCODE -eq 0) {
@MattJeanes
MattJeanes / get-cluster-requests-limits.ps1
Created December 23, 2022 13:01
Shows all Kubernetes deployments, statefulset and daemonset configured requests/limits for CPU and memory
$ErrorActionPreference = "Stop"
Write-Host "Daemonsets:`n"
$daemonsets = kubectl get daemonsets --all-namespaces --output json | ConvertFrom-Json
$daemonsets.items | Sort-Object { $_.metadata.name } | ForEach-Object {
$daemonset = $_
$daemonset.spec.template.spec.containers | Sort-Object Name | ForEach-Object {
Write-Host "$($daemonset.metadata.name) / $($_.Name), memory request: $($_.Resources.Requests.Memory ?? "N/A"), memory limit: $($_.Resources.Limits.Memory ?? "N/A"), cpu request: $($_.Resources.Requests.CPU ?? "N/A"), cpu limit: $($_.Resources.Limits.CPU ?? "N/A")"
}
@MattJeanes
MattJeanes / get-kubernetes-resource-usage.ps1
Last active July 14, 2022 23:36
Show a list of pods with their actual / request / limits for CPU and Memory all in a convenient place
param(
[Parameter(Mandatory = $true)]
[AllowEmptyString()]
[string]$Namespace
)
if (-not $Namespace) {
$Namespace = "default";
}
@MattJeanes
MattJeanes / convert-tabs-to-spaces.py
Created February 3, 2022 01:02
Convert an entire folder of files from tabs to spaces
from glob import iglob
import os
import sys
spaces_per_tab = 4
argc = len( sys.argv )
if argc < 2: