Skip to content

Instantly share code, notes, and snippets.

esphome:
name: water_bottles
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
from zigpy.profiles import PROFILES, zha
from zigpy.zcl.clusters.general import Basic, Identify,\
Ota, PowerConfiguration, Time, Groups
from zigpy.zcl.clusters.hvac import Thermostat
from zigpy.quirks import CustomDevice, CustomCluster
import zigpy.types as types
from zigpy.zcl import foundation
THERMOSTAT_CHANNEL = 'thermostat'
{
init: function(elevators, floors) {
var elevator = elevators[0]; // Let's use the first elevator
var requested_floors = new Set();
var stop_for_leavers = new Set();
var collectPassengersOnPass = function(elevator) {
elevator.on("passing_floor", function(floorNum, direction) {
@vigonotion
vigonotion / DrawAndroidBitmap.java
Created November 6, 2018 16:39
Easier draw a bitmap with aspect ratio in Android Java
/**
* Given a Rect with params left, top, right, bottom where each corner gets a value from the
* top left corner, return the Rect for a scaled bitmap at (x,y).
*
* size is the new width of the image.
*/
public Rect drawBitmapWithAspectRatio(Bitmap bitmap, float x, float y, float size, boolean centered) {
// Get the nee height based on the desired size and the bitmaps aspect ratio
@vigonotion
vigonotion / dijkstra.py
Created June 22, 2018 09:12
shortest path algorithm (dijkstra) with python
# The Path class
class Path:
def __init__(self, knot0, knot1, metric, sort=False):
self.knot0 = knot0
self.knot1 = knot1
self.metric = metric
def other(self, knot):
if self.knot0 == knot:
return self.knot1
// Variables
@import "admin/variables";
// Bulma
@import "node_modules/bulma/sass/utilities/_all";
// Override Bulma variables here
// Set the default font
$family-primary: 'Lato', 'Open Sans', sans-serif;
$family-secondary: 'Open Sans', sans-serif;
import processing.sound.*;
AudioIn input;
LowPass lowPass;
FFT fft;
int bands = 2048;
int samplerate = 44100;
float[] spectrum = new float[samplerate];