Skip to content

Instantly share code, notes, and snippets.

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

Matt Jeanes MattJeanes

🏳️‍🌈
View GitHub Profile
@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 February 5, 2024 09:06
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:
@MattJeanes
MattJeanes / whatsapp-dark.user.js
Last active June 5, 2020 10:13
Enables the beta WhatsApp dark theme (userscript)
// ==UserScript==
// @name WhatsApp Web Dark
// @namespace https://mattjeanes.com
// @version 1.0
// @description Enables the beta WhatsApp dark theme
// @author Matt Jeanes
// @match https://web.whatsapp.com/
// @grant none
// ==/UserScript==
@MattJeanes
MattJeanes / PublishAzWebApp.ps1
Created May 11, 2020 00:40
Native powershell implementation of Publish-AzWebApp (currently C# based)
$publishingUsername = '$xxx'
$publishingPassword = 'xxx'
$scmUri = 'https://xxx.scm.azurewebsites.net'
$zipFile = "xxx.zip"
$deployUrl = "$scmUri/api/zipdeploy?isAsync=true"
$deployStatusUrl = "$scmUri/api/deployments/latest"
$byteArray = [System.Text.Encoding]::ASCII.GetBytes($publishingUsername + ":" + $publishingPassword)
$authHeader = "Basic $([Convert]::ToBase64String($byteArray))"
@MattJeanes
MattJeanes / TARDIS.txt
Created May 10, 2020 23:34
TARDIS Expression 2 (GMod)
@name TARDIS
@inputs
@outputs XYZ:vector
@persist Target:entity TARDIS:entity Visible SavePos:vector SaveAng:angle
runOnChat(1)
if (first()|dupefinished()){
TARDIS=entity():isConstrainedTo():tardisGet()
TARDIS:createWire(entity(),"XYZ", "XYZ")
Target=owner()
entity():setAlpha(0)