- Cоздаем своего бота: Ищем в телеграмме бота @BotFather и говорим /newbot. В процессе создания получаем api-key для бота
- Добавляем в интересующий нас чат этого бота
- В этот же чат добавляем бота @myidbot и говорим ему /getgroupid@myidbot. Эта команда даст нам id чата
- В настройках Notification Channel графаны выбираем telegram и пишем туда полученные ранее api-key и id чата
This file contains 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
\definecolor{EYYellow}{RGB}{255,230,0} | |
\definecolor{EYBlack}{RGB}{46,46,56} | |
\definecolor{EYGray1}{RGB}{116,116,128} | |
\definecolor{EYGray2}{RGB}{196,196,205} | |
\definecolor{EYWhite}{RGB}{246,246,250} |
This file contains 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 os | |
import time | |
import numpy as np | |
import pandas as pd | |
import pandavro | |
def size(size, precision=2): | |
suffixes = ['B', 'KB', 'MB', 'GB', 'TB'] |
This file contains 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
class DynamicFieldsModelSerializer(serializers.ModelSerializer): | |
""" | |
A ModelSerializer that takes an additional `fields` argument that | |
controls which fields should be displayed. | |
based on https://bit.ly/2TnW0ZJ | |
Usage: api_endpoint/?fields=uid,name,alias,parent | |
api_endpoint/?fields!=parent | |
""" |
This file contains 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
from io import BytesIO | |
import fastavro | |
schema = { | |
"fields": [ | |
{ | |
"name": "maybe_enum", | |
"type": ["null", { | |
"type": "enum", | |
"name": "methods", |
This file contains 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
# -*- coding: utf-8 -*- | |
# Generated by Django 1.11 on 2017-05-31 11:05 | |
from __future__ import unicode_literals | |
from django.db import migrations | |
def load_stores_from_fixture(apps, schema_editor): | |
from django.core.management import call_command | |
call_command("loaddata", "dump.json") |
This file contains 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
from prometheus_client import CollectorRegistry, Gauge, generate_latest | |
registry = CollectorRegistry() | |
g = Gauge('reg_cnt', '1-2 per day is ok', registry=registry) | |
g.set(2) | |
print(generate_latest(registry)) |
This file contains 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
from OpenSSL import crypto | |
def createKeyPair(): | |
pkey = crypto.PKey() | |
pkey.generate_key(crypto.TYPE_DSA, 2048) | |
pubKeyString = crypto.dump_publickey(crypto.FILETYPE_PEM, pkey).decode('latin1') | |
privateKeyString = crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey).decode('latin1') | |
return pubKeyString, privateKeyString | |
This file contains 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
--{-# OPTIONS_GHC -Wall -Werror #-} | |
module Scheduler | |
( someFunc, | |
) where | |
import Data.Maybe (isJust, isNothing) | |
import qualified Data.Map as M | |
data SchedulerState = SchedulerState |
This file contains 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 datetime | |
from io import BytesIO | |
from pprint import pprint | |
from uuid import uuid4 | |
import fastavro | |
fastavro._reader.LOGICAL_READERS['long-timestamp-millis'] = lambda d, w, r: d | |
schema = { |
NewerOlder