Skip to content

Instantly share code, notes, and snippets.

import processing.sound.*;
AudioIn input;
LowPass lowPass;
FFT fft;
int bands = 2048;
int samplerate = 44100;
float[] spectrum = new float[samplerate];
// 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;
@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
{
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) {
esphome:
name: water_bottles
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
@vigonotion
vigonotion / diy-echo-link-amp.json
Last active July 16, 2019 19:01
DIY Echo Link Amp
@vigonotion
vigonotion / save_and_restore_states.yaml
Created December 27, 2019 20:04
Save and restore light states using Home Assistant (Node-RED automation)
[
{
"id": "1a171a83.11dfdd",
"type": "api-call-service",
"z": "25e52f9c.ae111",
"name": "save state",
"server": "e02cc9b7.16ead8",
"version": 1,
"debugenabled": false,
"service_domain": "scene",
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'
@vigonotion
vigonotion / campfire-orange.yaml
Created April 26, 2020 17:20
Theme for Home Assistant
# Main colors
primary-color: '#ffb430' #322a65
accent-color: '#ffb430' #312868
#dark-primary-color: '#2980b9'
light-primary-color: '#fff6e6'
#mdc-theme-primary: '#e971ae'
# Backgrounds
lovelace-background: 'center / cover no-repeat url("/local/background.jpg?v=1") fixed'
[{"id":"6e393969.673f5","type":"server-state-changed","z":"974a0bef.a0e068","name":"Someone comes 🏠","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"person\\..*","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":110,"y":620,"wires":[["49d067bc.f7f448"],[]]},{"id":"49d067bc.f7f448","type":"delay","z":"974a0bef.a0e068","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":235,"y":620,"wires":[["e01bf48d.d8b98"]],"l":false},{"id":"e01bf48d.d8b98","type":"function","z":"974a0bef.a0e068","name":"Filter family","func":"let family = ['person.alice', 'person.bob', 'person.celine', 'person.dylan'];\n\nif(family.includes(msg.topic)) {\n node.status({fill:\"