Skip to content

Instantly share code, notes, and snippets.

View martinlindhe's full-sized avatar
😸

Martin Lindhe martinlindhe

😸
View GitHub Profile
@pavax
pavax / motion_aware_lights.yaml
Last active April 6, 2025 22:20
Home Assistant Motion Aware Lights Blueprint
blueprint:
name: Motion-Aware Light Control
description: >
Automatically controls lights based on motion detection, with optional conditions for illuminance and binary sensors.
The automation can be disabled using binary sensors (e.g., sleep mode or movie watching) to prevent lights from turning on under certain conditions.
Additionally, if the lights were already turned on and motion is detected, the automation will wait for the motion detection to clear before turning off the lights.
domain: automation
source_url: https://gist.github.com/pavax/ce9559c428b9a3c369ce79ef215ef1e2
homeassistant:
@gregneagle
gregneagle / gist:01c99322cf985e771827
Created January 20, 2015 18:16
Using CFPreferences in Python to set a complex preference
import plistlib
import CoreFoundation
from Foundation import NSDate, NSMutableArray, NSMutableDictionary
# read the current ManagedPlugInPolicies
policy = CoreFoundation.CFPreferencesCopyAppValue("ManagedPlugInPolicies", "com.apple.Safari")
if policy:
# policy is an immutable dict, so we have to make a mutable copy
my_policy = NSMutableDictionary.alloc().initWithDictionary_copyItems_(policy, True)
@nsf
nsf / clean.bash
Last active March 4, 2019 14:38
Perlin noise benchmark
#!/bin/bash
rm -rf *.o *.[568] test_*