This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Обязательно https://ohmyz.sh/ | |
| # | |
| # Тут дефолтное содержимое файла ~/.zshrc | |
| # Дальше – кастомное (https://gitlab.corp.mail.ru/-/snippets/2069) | |
| # | |
| # | |
| # git shortcuts | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias: Мониторинг давления воды (ввод) | |
| description: Отправляет уведомления при падении и восстановлении давления воды | |
| triggers: | |
| - trigger: template | |
| id: pressure_drop | |
| value_template: | | |
| {% set current = states('sensor.davlenie_vody_vvod_bar') | float(0) %} | |
| {% set average = states('sensor.srednee_davlenie_vody_vvod') | float(0) %} | |
| {% set threshold = average * 0.6 %} | |
| {{ current < threshold and current > 0 and average > 0 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Для второго condition требуется интеграция: https://www.home-assistant.io/integrations/uptime/ | |
| # | |
| alias: Мониторинг напряжения - восстановление | |
| description: Отправляет уведомления при восстановлении напряжения выше 189В | |
| triggers: | |
| - entity_id: | |
| - sensor.datchik_napriazheniia_1_ext_voltage | |
| - sensor.datchik_napriazheniia_2_ext_voltage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias: Мониторинг напряжения - отсутствие/изменение | |
| description: Отправляет уведомления при падении/повышении/отсутствии напряжения на фазах | |
| triggers: | |
| - entity_id: | |
| - sensor.datchik_napriazheniia_1_ext_voltage | |
| - sensor.datchik_napriazheniia_2_ext_voltage | |
| - sensor.datchik_napriazheniia_3_ext_voltage | |
| below: 190 | |
| id: voltage_low | |
| trigger: numeric_state |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| $ pip install flask sqlalchemy psycopg2-binary | |
| $ FLASK_ENV=development FLASK_APP=app.py flask run | |
| """ | |
| import random | |
| from flask import Flask, abort, request, views | |
| from sqlalchemy import Column, MetaData, String, Table, create_engine, select | |
| from string import ascii_letters | |
| from typing import Optional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| """ | |
| Original: https://gist.github.com/mikeyk/1329319 | |
| https://instagram-engineering.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c | |
| ➜ time python benchmarks/redis_hset_set.py normal | |
| Set: 79.34 sec | |
| Size: 92.6 MB | |
| Get: 73.74 sec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function is_https() { | |
| // dont use `filter_input(INPUT_SERVER, '...')`: | |
| // https://github.com/xwp/stream/issues/254 | |
| $https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : ''; | |
| if (!empty($https)) { | |
| $https = strtolower($https); | |
| if ($https == 'on') { | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd /var | |
| find . -type d | | |
| while | |
| read line | |
| do | |
| echo "$( find "$line" -maxdepth 1 | wc -l) $line" | |
| done | | |
| sort -rn | less |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import yadisk # https://pypi.org/project/yadisk/ | |
| def check_auth(y): | |
| if y.check_token(): | |
| print("Token valid") | |
| else: | |
| raise Exception('Token invalid!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| authtoken: <copy key from https://dashboard.ngrok.com/auth> | |
| log_level: error | |
| log: stderr |
NewerOlder