Skip to content

Instantly share code, notes, and snippets.

View starbuck93's full-sized avatar
:bowtie:

Adam Starbuck starbuck93

:bowtie:
View GitHub Profile
@starbuck93
starbuck93 / chromecast_with_google_tv.yaml
Last active May 7, 2023 17:53
new Chromecast with Google TV integration and Lovelace card example
type: custom:tv-card
entity: remote.my_remote
title: Chromecast
power_row:
- back
- power
- home
apps_row:
- netflix
- disneyplus
@starbuck93
starbuck93 / readme.md
Last active February 15, 2023 17:12
Regex sed command to remove a bunch of junk from new Google Sites takeout data

The purpose of this sed command is to get rid of the extra stuff from my Google Takeout of a "new" Google Site to eventually import it into Outline Wiki.

This will read the whole file in a loop (:a;N;$!ba), then match everything from the beginning of the file (^.*) until the substring </header> and replace it with the replacement (blank).

Then, once I import the file into Outline Wiki, I'll re-link the pictures if there are any, and reorganize the structure of the sidebar from Google Sites. But, removing all the extra HTML will make this much faster.

@starbuck93
starbuck93 / inovelli_vzm31-sn.yaml
Last active May 14, 2024 13:23
Inovelli Blue Series 2-in-1 blueprint demo for Home Assistant
blueprint:
name: Z2M - Inovelli 2-in-1 switch + dimmer Scene Controls
description: |
For Inovelli Blue Series 2-in-1 switch + dimmer, model VZM31-SN
Allows setting a few different actions such as 2,3,4,5 clicking the up/down and config buttons.
domain: automation
input:
switch:
name: Switch
@starbuck93
starbuck93 / update_portainer.sh
Last active March 28, 2022 14:48
Update to the latest Portainer CE using docker commands
#!/bin/bash
#Assuimg your current Portainer container name is simply "portainer"
docker stop portainer
docker rm portainer
docker image ls | grep portainer | awk '{print $3}' | xargs -I {} docker image rm {}
docker pull portainer/portainer-ce:latest
docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
@starbuck93
starbuck93 / blueprint.yaml
Last active May 15, 2021 19:50
Z2M - IKEA five button remote for lights
blueprint:
name: Z2M - IKEA five button remote for lights
description: |
Control lights with an IKEA five button remote (the round ones).
The middle "on" button, toggle the lights on/off to the last set brightness
(unless the force brightness is toggled on in the blueprint).
Dim up/down buttons will change the brightness smoothly and can be pressed
and hold until the brightness is satisfactory.
@starbuck93
starbuck93 / gist:2c9ad8f6a6d0a57f1164352c80ab0531
Last active September 14, 2020 18:05 — forked from maccath/gist:3981205
Split PDF to individual pages using FPDI and FPDF while keeping the original PDF's size
<?php
/**
* Split PDF file
*
* <p>Split all of the pages from a larger PDF files into
* single-page PDF files.</p>
*
* @package FPDF required http://www.fpdf.org/
* @package FPDI required http://www.setasign.de/products/pdf-php-solutions/fpdi/

Keybase proof

I hereby claim:

  • I am starbuck93 on github.
  • I am starbuck93 (https://keybase.io/starbuck93) on keybase.
  • I have a public key ASB_yMZmYe07-8w34vqvDHLNldTZK1jv2rNfSPtXyk3tRgo

To claim this, I am signing this object:

@starbuck93
starbuck93 / main.py
Last active January 11, 2019 15:14
DoorLaser -- using a garage door laser beam to detect people walking through a doorway
#borrowed from https://www.hackster.io/hardikrathod/pir-motion-sensor-with-raspberry-pi-415c04
#and https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/
import RPi.GPIO as GPIO
import time
#import sys
#from influxdb import InfluxDBClient
import requests
import automationhat
@starbuck93
starbuck93 / index.php
Created August 14, 2018 14:31
Quick script to echo the CPU temperature in F and C of a Raspberry Pi Zero, in my case
<?php
$command = "cat /sys/class/thermal/thermal_zone0/temp";
$temp = exec($command);
$tempC1 = ((float) $temp)/1000;
$tempF1 = ($tempC1*(9.0 / 5.0)) + 32.0;
$str = '{"cpu_temperature_F":'.number_format($tempF1,2).',"cpu_temperature_C":'.number_format($tempC1,2).'}';
echo $str;
?>
@starbuck93
starbuck93 / is_the_ac_running.py
Last active July 4, 2018 20:51
is the ac running based on if the temperature is rising or falling
import homeassistant.remote as remote
import time
import math
import sys
def updateState(previous,current):
settings = {"device_class": "cold", "friendly_name": "Is the AC Running"}
if previous.state != current.state and math.fabs(float(previous.state)-float(current.state)) > .2: #if the absolute value delta is between 0 and 0.2 then we don't want to update the state to prevent false positives
if previous.state > current.state: #air temp is falling
print(":: ",current.state,"AC is running")