Skip to content

Instantly share code, notes, and snippets.

View janek26's full-sized avatar
🏠
Working from home

Janek janek26

🏠
Working from home
View GitHub Profile
blueprint:
name: "Philips Hue Dimmer Switch V2 (ZHA)"
description: >
Blueprint für den Philips Hue Dimmer Switch V2 (RWL022) über ZHA.
Unterstützt für alle 4 Tasten:
• Kurzer Druck (Short Press)
• Halten / Wiederholen (Hold) – feuert wiederholt solange die Taste gedrückt ist, ideal zum Dimmen
• Loslassen nach Halten (Long Release)
# Blueprint metadata
blueprint:
name: Controller - Philips 929002398602 Hue Dimmer switch v2
description: |
# Controller - Philips 929002398602 Hue Dimmer switch v2
Controller automation for executing any kind of action triggered by the provided Philips 929002398602 Hue Dimmer switch v2. Allows to optionally loop an action on a button long press.
Supports ZHA, Zigbee2MQTT.
Automations created with this blueprint can be connected with one or more [Hooks](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks) supported by this controller.
@janek26
janek26 / machine.js
Created August 11, 2021 09:38
Generated by XState Viz: https://xstate.js.org/viz
const sendMachineDefaultContext = {
amount: "",
contract: "0x0",
walletAddress: "",
transactionHash: null,
tokens: [],
zkSyncTokens: [],
zkSyncConfig: null,
}
@janek26
janek26 / machine.js
Created August 11, 2021 09:37
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@janek26
janek26 / machine.js
Last active August 5, 2021 14:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import React, { FC, ComponentType } from 'react';
interface Props {
Providers: { component: ComponentType<any>; props?: any }[];
}
export const ComposeProviders: FC<Props> = ({ Providers, children }) =>
Providers.reverse().reduce((acc, Provider) => {
return (
<Provider.component {...(Provider.props || {})}>
import React, { Component } from 'react'
// <TODO /> COMPONENT
// React function component ( without state => stateless )
const Todo = ({ todo }) => <li>{todo}</li>
// <TODOS /> COMPONENT
// React function component ( without state => stateless )
const Todos = ({
// destructure todo and default to empty array ( when undefined default to [] )
@janek26
janek26 / crypto.js
Last active February 24, 2022 18:26
Simple aes and sha256 for browsers using window.crypto
// exports:
// - supportsCrypto() : bool
// - randomString(length : int) : string
// - aesEncrypt(value : string, password : string) : string
// - aesDecrypt(encryptedMsg : string, password : string) : string
// - sha256(value : string) : string
// if you use this code in Node import crypto and TextEncoder
import WebCrypto from 'node-webcrypto-ossl'
import { TextEncoder, TextDecoder } from 'util'
042e0613004c163cf0f695244dd84033ecbe337100f27aa07573ee36dbc70ee2d69bbb5a233fd5bc1403c15886207b6335de9a82b07ff56a89d83d166fc6436141 c-darwin
0xF1635DB5Ed3e8721A61eA25b7e1f6EEd805407b7