Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Begin looking at the system log via the steam sub-command. Using a --predicate and filtering by the correct
# subsystem first improves CPU performance DRASTICALLY. Then just pull out the camera event
log stream --predicate 'subsystem == "com.apple.VDCAssistant" && eventMessage CONTAINS[c] "Post event kCameraStream"'| while read line; do
# If we catch a camera start event, turn the light on
if echo "$line" | grep -q "Post event kCameraStreamStart"; then
echo "Camera has been activated, turn on the light."
curl -s -o /dev/null http://192.168.1.198/gpio/1

Keybase proof

I hereby claim:

  • I am davemay99 on github.
  • I am lamont2112 (https://keybase.io/lamont2112) on keybase.
  • I have a public key ASDRXUp6bLrI95cnoLBRlCx5rljqE9fTA-RTsfltmPSjLAo

To claim this, I am signing this object: