Skip to content

Instantly share code, notes, and snippets.

View denysdovhan's full-sized avatar
👨‍💻
Working for @wix

Denys Dovhan denysdovhan

👨‍💻
Working for @wix
View GitHub Profile
const readline = require('readline');
const REFRESH_INTERVAL = 50;
// Function to clear the terminal
function clearTerminal() {
console.clear();
}
// Function to generate random characters
@denysdovhan
denysdovhan / announcement.yaml
Created August 9, 2024 16:33
Annoucement script boilerplate
blueprint:
name: Announcement
author: denysdovhan
description: >
This is a generic announcement with randomly generated phrases.
# source_url: TODO
domain: script
input:
default_tts:
name: TTS Service
# based on: https://community.home-assistant.io/t/tuya-radiator-valve-ts0601-calibration-from-external-sensor-via-zigbee2mqtt/337991
# alternative: https://community.home-assistant.io/t/sync-trv-with-external-tempature-sensor/298024
blueprint:
name: Calibrate TRV temperature
description: Temperature calibration for Zigbee valve TS0601, according to external temperature sensor
domain: automation
input:
valve:
name: Valve
hmarochos.kiev.ua##.mainPageAdvRightBlock
hmarochos.kiev.ua###donate
hmarochos.kiev.ua##.lybidbanner
hmarochos.kiev.ua###enhancedtextwidget-14
hmarochos.kiev.ua##.bannernews
hmarochos.kiev.ua###hmarochos_logo_bw
pravda.com.ua##.container_sub_adv_content
connection.id: my-network
connection.uuid: d667788a-27b8-403e-b369-087868ba0102
connection.stable-id: --
connection.type: 802-11-wireless
connection.interface-name: --
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.multi-connect: 0 (default)
connection.auth-retries: -1
System: HassOS 3.13 (armv7 / raspberrypi4)
Home Assistant Core: 0.109.6
Home Assistant Supervisor: 222
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
Log level is set to DEBUG

Keybase proof

I hereby claim:

  • I am denysdovhan on github.
  • I am denysdovhan (https://keybase.io/denysdovhan) on keybase.
  • I have a public key ASAsVrM0k1lbh4HVegGJDnrOF7f6kfTjsncP0eSX55Taxwo

To claim this, I am signing this object:

@denysdovhan
denysdovhan / async-prompt.zsh
Last active December 18, 2019 20:49
Async prompt examples for Spaceship ZSH (zsh-async is required: https://github.com/mafredri/zsh-async)
#!/usr/bin/env zsh
# zsh-async is required:
# https://github.com/mafredri/zsh-async
source $PWD/async.zsh
async_init
# cache variable
typeset -Ag prompt_data
@denysdovhan
denysdovhan / noncoercible.js
Created February 18, 2017 18:32 — forked from chicoxyzzy/noncoercible.js
Non-coercible objects
function nonCoercible(val) {
if (val == null) {
throw TypeError('nonCoercible shouldn\'t be called with null or undefined');
}
const res = Object(val);
res[Symbol.toPrimitive] = () => {
throw TypeError('Trying to coerce non-coercible object');
}
return res;
};

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () => x) {