Skip to content

Instantly share code, notes, and snippets.

View show_github_repos.pl
#!/usr/bin/perl
=encoding UTF-8
=cut
=head1 DESCRIPTION
=cut
# common modules
View gist:840045383ab4ab0bd5a1eb266c5b1219
$ curl -s 'https://www.artlebedev.ru/country-list/tab/' > countries.tsv; curl -s 'https://analytics.home-assistant.io/data.json' |perl -MJSON::PP -MData::Dumper -nalE '$c .= $_; }{ $d = decode_json $c; foreach (keys %{$d}) { if ($d->{$_}->{countries}) { foreach $id (keys %{$d->{$_}->{countries}}) { say $id, " ", $d->{$_}->{countries}->{$id}} } }'|sort -k2 -nr|head -30|perl -C -nalE '$tsv = `cat countries.tsv`; @lines = split/\n/, $tsv; foreach (@lines) { @f = split /\t/,$_; $id2name{$f[3]} = $f[0] }; $i++; say sprintf "%2s %2s %-25s %10s", $i, $F[0], $id2name{$F[0]}, $F[1]'
1 US Соединенные Штаты 1613
2 NL Нидерланды 974
3 DE Германия 790
4 GB Соединенное Королевство 655
5 PL Польша 490
6 IT Италия 414
7 SE Швеция 365
8 FR Франция 316
9 AU Австралия 303
View configuration.yaml
default_config:
input_number:
n1:
min: 0
max: 100
step: 1
input_boolean:
b1:
@bessarabov
bessarabov / gist:d6ad1df13cf0a79f54afa35933e8dc38
Created Apr 7, 2021
oneliner to show Home Assistant releases in MSK timezone
View gist:d6ad1df13cf0a79f54afa35933e8dc38
bessarabov@bessarabov-osx:~/Dropbox/git/core$ git tag|perl -nalE 'say if /\.0\z/'|perl -nalE 'say if /^2/ || /^0\.11/'|perl -nalE 'say $_, " ", `git show --format=%at $_`'|perl -nalE 'say if /\S/' |perl -nalE 'say sprintf "%-12s %1s", $F[0], `date -r $F[1]`'|perl -nalE 'say if /\S/'
0.110.0 Wed May 20 11:14:49 MSK 2020
0.111.0 Wed Jun 10 17:07:38 MSK 2020
0.112.0 Wed Jul 1 17:47:17 MSK 2020
0.113.0 Wed Jul 22 18:45:03 MSK 2020
0.114.0 Wed Aug 12 13:52:23 MSK 2020
0.115.0 Thu Sep 17 18:37:29 MSK 2020
0.116.0 Wed Oct 7 18:50:57 MSK 2020
0.117.0 Wed Oct 28 22:01:21 MSK 2020
0.118.0 Wed Nov 18 21:01:29 MSK 2020
View garage_dht22.yaml
esphome:
name: garage_dht22
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
View gist:f500446233940632a980a237ee77e452
sqlite> select state_id, created, state from states where entity_id = 'sensor.0x04cf8cdf3c77656a_illuminance' and created > '2021-03-24 01' order by state_id limit 40;
state_id created state
---------- -------------------------- ----------
15748089 2021-03-24 02:33:23.770811 0
15751204 2021-03-24 03:00:33.952611 0
15751482 2021-03-24 03:03:23.234313 0
15751485 2021-03-24 03:03:23.238100 3011
15751830 2021-03-24 03:06:22.438813 3011
15751833 2021-03-24 03:06:22.440488 4772
15752210 2021-03-24 03:09:46.574502 4772
View bw_shp8_towel_rail.yaml
substitutions:
device_name: bw_shp8_towel_rail
upper_devicename: "BW-SHP8 Towel Rail"
# Higher value gives lower watt readout
current_res: '0.00221'
# Lower value gives lower voltage readout
voltage_div: '825'
View configuration.yaml
default_config:
input_number:
working_hours:
initial: 0
min: 0
max: 5
step: 0.01
tmp:
View display1.yaml
esphome:
name: display1
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
@bessarabov
bessarabov / clock.yaml
Created Dec 31, 2020
Clock that shows current year. ESPHome + Home Assistant
View clock.yaml
esphome:
name: clock
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger: