Skip to content

Instantly share code, notes, and snippets.

import paho.mqtt.client as mqtt
import struct
from functools import reduce
from pydantic import ValidationError
from pydantic.color import Color
class Techlife():
msg = struct.Struct('<B6H3B')
def __init__(self, mqtt_server, mac_addr, username=None, password=None):
@csabavirag
csabavirag / TechLifePro_Setup.py
Last active February 4, 2024 12:14
Techlife pro Smart Bulb scripts
#!/usr/bin/env python
# 1. Modify the variables according to your setup: ssid, password, bssid, [email]
# 2. Connect the computer to AP-TechLife-xx-xx SSID
# 3. Run the script
import socket
# Variables to change
ssid = '**YOURSSID**'
password = '**WIFIPASSWORD**'
bssid = bytearray([0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa]) # Enter your WiFi router's WiFi interface MAC address in hex (eg. AA:AA:AA:AA:AA:AA)
@guysmoilov
guysmoilov / Git pre-commit hook for large files.md
Last active February 14, 2024 23:46
Git pre-commit hook for large files

Git pre-commit hook for large files

This hook warns you before you accidentally commit large files to git. It's very hard to reverse such an accidental commit, so it's better to prevent it in advance.

Since you will likely want this script to run in all your git repos, a script is attached to add this hook to all git repos you create / clone in the future.

Of course, you can just download it directly to the hooks in an existing git repo.

If you find this script useful, you might enjoy our more heavy-duty project FastDS, which aims to make it easier to work with versioning in data science projects.