Skip to content

Instantly share code, notes, and snippets.

package main
import (
"crypto/tls"
"log"
"net"
"net/http"
"net/http/httputil"
"net/url"
)
@imduffy15
imduffy15 / README.md
Created February 11, 2023 13:43
My home assistant organiser

cleaner.py

This hides things and renames things.

area-assigner.py

This assigns things to areas based on their name

alexa-sync.py

#!/usr/bin/env python
import json
import requests
import urllib3
urllib3.disable_warnings()
cookie = open("cookie.txt").readline().strip()
csrf_token = [x.split("=") for x in cookie.split(";") if "csrf" in x][0][1]
@imduffy15
imduffy15 / motion_controlled_scenes_enhanced.yaml
Last active July 5, 2021 22:30 — forked from quallenbezwinger/motion_controlled_scenes_enhanced.yaml
Homeassistant blueprint for motion-activated light scene with surrounding light level check
blueprint:
name: Motion-activated light scene with surrounding light level check and optional ambient scene
description: Turn on a light scene when motion is detected. Three different scenes can be defined depending on time of day. Furthermore a source for checking sourrounding light can be defined to enable light only if it is dark enough.
domain: automation
source_url: https://gist.github.com/dirkk1980/3e5c23acb05fb639bafdc5036b91aae6
input:
motion_entity:
name: Motion Sensor
selector:
entity:

OpenTelemetry Problem

The kafka producer doesn't appear to get the traceId of the scope its wrapped in.

FROM debian:buster-slim
# Install Chrome
RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common \
&& apt-add-repository contrib \
&& apt-get update \
&& apt-get install -y \
apt-transport-https \
ca-certificates \
{
"jobPosting": {
"description": "DESCRIPTION\n\nThe Amazon Payments Team manages all Amazon branded payment offerings, globally. These offerings are growing rapidly and we are continuously adding new market-leading features and launching new products. Our payments products (Amazon Co-Branded Credit Cards, Gift Cards, Points, Shop with Points and Installments ) provide the most innovative payment experience on and off Amazon. We manage a financial services ad serving platform (billions of impressions per year) through Amazon’s purchase path where we offer Amazon branded and non-branded payment products and services. Our team of high caliber software developers, statisticians, analysts and product managers use rigorous quantitative approaches to ensure that we target the right product to the right customer at the right moment, managing tradeoffs between click through rate, approval rates and lifetime value. We leverage the wealth of Amazon’s information to build a wide range of probabilistic models, set
import json
from http.client import HTTPResponse
from http.server import BaseHTTPRequestHandler
from io import BytesIO
class HTTPRequest(BaseHTTPRequestHandler):
def __init__(self, request):
BaseHTTPRequestHandler.__init__(self, request, "127.0.0.1", None)
package main
import (
"encoding/json"
"github.com/eclipse/paho.mqtt.golang"
"github.com/hpcloud/tail"
"github.com/hpcloud/tail/watch"
"log"
"os"
"regexp"
arctic aurora
{
"bri": 137,
"on": true,
"xy": [
0.155353,
0.356466
]
}