This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from: https://community.home-assistant.io/t/motion-activated-light-but-with-conditions/466228 | |
# | |
# Works better with presence sensors by using a helper boolean | |
blueprint: | |
name: Motion-activated Light for Presence Sensors | |
description: Turn on a light when motion is detected. | |
domain: automation | |
input: | |
motion_entity: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: ZHA - Moes Smart Knob for lights | |
description: 'Control lights with a Moes Smart Knob. | |
You can set functions for a single press. This allows you to assign, e.g., a scene | |
or anything else. | |
Rotating left/right will change the brightness smoothly of the selected light. | |
Not all functionality of the device is available at time of writing, e.g. double | |
press, long press and press and rotate. | |
Original blueprint by seamus65 (https://gist.github.com/seamus65/939a147634942dd885c8704334627f93). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("render.star", "render") | |
load("encoding/base64.star", "base64") | |
load("hash.star", "hash") | |
# Author: Taneli Leppä <rosmo@rosmo.fi> | |
# PNG encoder from: https://github.com/miloyip/svpng | |
# Base64 encoder from: https://gist.github.com/caseyscarborough/8467877 | |
def generate_png(w, h): | |
t = [ 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c ] # CRC32 table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import json | |
import tempfile | |
import sys | |
import os | |
parser = argparse.ArgumentParser( | |
description='Validate a Terraform plan file against deletions.') | |
parser.add_argument('file', type=str, help='file to validate') | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install community Terminal & SSH addon, disable protection | |
2. Log into home assistant via SSH | |
3. ls -l /dev/serial/by-id | |
total 0 | |
lrwxrwxrwx 1 root root 13 Dec 15 09:56 usb-Nabu_Casa_SkyConnect_v1.0_34b60e0f8318ec11a66ef69a47486eb0-if00-port0 -> ../../ttyUSB0 | |
lrwxrwxrwx 1 root root 13 Dec 15 09:56 usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B001CDD4956-if00 -> ../../ttyACM0 | |
4. pip install git+https://github.com/zigpy/zigpy-cli.git | |
5. Disable CC2531 in Home Assistant | |
5. Make backup: zigpy -vv radio znp /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B001CDD4956-if00 backup znp.json | |
6. Restore backup: zigpy -vv radio znp /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_34b60e0f8318ec11a66ef69a47486eb0-if00-port0 restore znp.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Service] | |
Environment=GOOGLE_SERVICE_CREDENTIALS=/etc/google/auth/application_default_credentials.json | |
ExecStartPre=/bin/sed -i "s/gce_instance/generic_node\\n location europe-west3\\n namespace example\\n node_id host.example.com/g" ${RUNTIME_DIRECTORY}/fluent_bit_main.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests.api import request | |
from Crypto.Cipher import PKCS1_OAEP, PKCS1_v1_5 | |
from Crypto.Cipher import AES | |
from Crypto.PublicKey import RSA | |
from Crypto.Util.Padding import pad | |
from Crypto.Util.number import bytes_to_long | |
import base64 | |
import requests | |
import string | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To build and deploy: | |
# | |
# docker build -t gcr.io/YOUR-PROJECT/gsc2bq-cloudrun:latest . | |
# docker push gcr.io/YOUR-PROJECT/gsc2bq-cloudrun:latest | |
# | |
# gcloud run deploy gcs2bq --image=gcr.io/YOUR-PROJECT/gsc2bq-cloudrun:latest \ | |
# --service-account=your-sa@YOUR-PROJECT.iam.gserviceaccount.com \ | |
# --timeout=60m --set-env-vars=GCS2BQ_PROJECT=YOUR-PROJECT,... \ | |
# --region=europe-west4 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete_vpc_components() { | |
echo aws ec2 "describe-${7}" --filters "Name=$4,Values=$3" --output text --query "*[*].$5" --region $1 | |
for id in $(aws ec2 "describe-${7}" --filters "Name=$4,Values=$3" --output text --query "*[*].$5" --region $1) | |
do | |
echo "Deleting $2: $id" | |
if [ "$2" == "internet-gateway" ] ; then | |
aws ec2 detach-internet-gateway $6 $id --vpc-id $3 --region $1 | |
fi | |
aws ec2 "delete-${2}" $6 $id --region $1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Convert a Row-Based-Replication binary log to Statement-Based-Replication format, cheating a little. | |
# | |
# Additional added some code to transfer INSERT clauses to proper column names. | |
# | |
# Usage: mysqlbinlog -v --base64-output=DECODE-ROWS $log | python binlog-rbr-to-sbr.py -hHOST -uUSERNAME -pPASSWORD - | grep -B 1 '^INSERT ' | |
# Based on: https://gist.github.com/shlomi-noach/cc243fd690403e7617e3 | |
# |