Skip to content

Instantly share code, notes, and snippets.

@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 16, 2023 05:04
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
View gist:674ea13c77fc8128f24b5e3f53b7f094
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
View gist:06203f1d49e11b27ed977b0225bb5c2c
bessarabov@bessarabov-osx:~$ cdt
bessarabov@bessarabov-osx:~/tmp/delete_after_2023-01-13$ time git clone git@github.com:git/git.git
Cloning into 'git'...
remote: Enumerating objects: 339509, done.
remote: Total 339509 (delta 0), reused 0 (delta 0), pack-reused 339509
Receiving objects: 100% (339509/339509), 209.15 MiB | 7.29 MiB/s, done.
Resolving deltas: 100% (254125/254125), done.
Updating files: 100% (4300/4300), done.
real 0m59.357s
View gist:aa8b45465e488bd75adcc834461954d5
commit 0a729b3acb0cb2f110002bef49ec43be20060c27
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: Fri Apr 22 23:24:15 2022 +0300
Fixing telegram bot multiline commands
https://t.me/modernperl/206743
Alexander P, [22 Apr 2022, 22:44:37]:
@PerlBanjoBot
View bw_shp8_boiler.yaml
# Based on https://community.home-assistant.io/t/esphome-blitzwolf-bw-shp6-configuration/113938/13?u=bessarabov
substitutions:
device_name: bw_shp8_boiler
upper_devicename: "BW-SHP8 Boiler"
# Higher value gives lower watt readout
current_res: '0.00221'
View gist:afff0c47df50e9ef1faaf2dbac64595d
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
View configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
script: !include scripts.yaml
View configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
View gist:ec4abf6c63e4150d12cc954a4253552f
sensor:
- platform: template
sensors:
pzem_kwh:
unit_of_measurement: kWh
value_template: "{{ states('sensor.pzem_004t_v3_energy') | float / 1000 }}"
utility_meter:
daily_energy_pzem:
@bessarabov
bessarabov / fridge.yaml
Created April 30, 2021 11:02
Датчики температуры в холодильнике для Home Assistant
View fridge.yaml
binary_sensor:
- platform: template
sensors:
fridge_top_temperature_is_ok:
value_template: >-
{{ (states('sensor.0x00158d00045f5f93_temperature') | float > 5)
and (states('sensor.0x00158d00045f5f93_temperature') | float < 12) }}
fridge_bottom_temperature_is_ok:
View show_github_repos.pl
#!/usr/bin/perl
=encoding UTF-8
=cut
=head1 DESCRIPTION
=cut
# common modules