Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int alt1(const char *s)
{
int i;
for(i=0; s[i]; s[i]==':'?i++:(int)(s++));
return i;
}
int alt2(const char *s)
{
int i = 0;
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z $BUILDROOT ]; then
BUILDROOT=$DIR/..
fi
. $BUILDROOT/util/common.sh
input_text:
koksradio:
initial: ""
switch:
- platform: templatek
switches:
koksradio_p1:
value_template: "{{ is_state('media_player.kok', 'playing') and is_state('input_text.koksradio', 'P1') }}"
turn_on:
#! /usr/bin/env python3
import numpy as np
import cv2
from matplotlib import pyplot as plt
import os
def order_points(pts):
rect = np.zeros((4,2), dtype = "float32")
s = pts.sum(axis = 1)
homeassistant:
customize:
package.node_anchors:
coffee_switch: &cfe_switch switch.kaffebryggare
coffee_remote: &cfe_remote switch.kaffekontroll
common: &common
package: 'devices/coffeemaker'
input_boolean.cfe_on:
@thomasloven
thomasloven / default.conf
Created February 12, 2019 22:02
nginx-ssl-proxy subdomains
####################
default.conf
####################
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
server_name _;
class DimImageElement extends Polymer.Element {
async setConfig(config) {
this.dim_entity = config.dim_entity;
this.img = document.createElement('hui-image-element')
this.img.setConfig(config);
this.appendChild(this.img)
}
set hass(hass) {
this.img.hass = hass;
attribute = data.get('attribute')
value = data.get('value')
service = data.get('service')
service_data = data.get('data', {})
# hass.services.call('system_log', 'write', {"message": str(data)})
for entity in hass.states.entity_ids():
state = hass.states.get(entity)
#!/usr/bin/env bash
MD5="md5"
HOSTNAME=`hostname -s`
if [[ -n $1 ]]; then HOSTNAME=$1; fi
HASH=`echo ${HOSTNAME} | ${MD5}`
echo -n -e "\033[38;05;$((0x${HASH:4:6}))m"
homeassistant:
customize:
package.node_anchors:
coffee_switch: &cfe_switch switch.kaffebryggare
coffee_remote: &cfe_remote switch.kaffekontroll
common: &common
package: 'devices/coffeemaker'
input_boolean.cfe_on: