Skip to content

Instantly share code, notes, and snippets.

@christovic
christovic / motion_light_sun_single.yaml
Last active February 18, 2021 20:16
Motion activated lights for a single entity
blueprint:
name: Motion-activated Light (Single entity)
description: Turn on a light when motion is detected and turn it off after specified time.
domain: automation
source_url: https://gist.github.com/christovic/88bddda364af9c6ed6f67ebbaf9e5b09
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@christovic
christovic / motion_light_sun.yaml
Last active February 18, 2021 20:01
Have lights come on with motion when the sun is below a specified elevation and before a certain time
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://gist.github.com/christovic/8acb058b915394997946e35e3a126d2a
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@christovic
christovic / motion_light_sun_with_time.yaml
Last active February 22, 2021 15:15
Have lights come on with motion when the sun is below a specified elevation
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://gist.github.com/christovic/b5a2cbcfba81edc81a2bc3d2f96c7f11
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@christovic
christovic / wg_64bit_kernel.sh
Last active July 7, 2020 23:18
Enabling WireGuard on a Raspberry Pi with 64-bit kernel
sudo apt install -y zip git wget
mkdir ubuntu; cd ubuntu
function post_chroot {
cat <<EOT >> build.sh
apt update
apt-get install -y libelf-dev build-essential pkg-config bc bison flex libssl-dev kmod
cd linux-raspberrypi-kernel_1.20200512-2
make bcm2711_defconfig
make prepare
#!/bin/bash
# We can find the index of the item in the array by extracting the key, finding the lines with
# 'string' in them, and then finding the search string.
cd /System/Volumes/Data/.Spotlight-V100
search_string=$1
let index="`plutil -extract Exclusions xml1 -o - VolumeConfiguration.plist | grep string | grep -wn "${search_string}" | cut -d ':' -f 1` - 1"
!/bin/bash
launchctl stop com.apple.metadata.mds && launchctl start com.apple.metadata.mds
vers=$( sw_vers | grep BuildVersion | awk '{print substr($2,0,2)}' )
sdir="/.Spotlight-V100"
if [[ "${vers}" > "18" ]]; then
sdir="/System/Volumes/Data${sdir}"