Skip to content

Instantly share code, notes, and snippets.

View churnikov's full-sized avatar
🤔
I'm Nikita by the way

Nikita Churikov churnikov

🤔
I'm Nikita by the way
View GitHub Profile
@churnikov
churnikov / loguru_vs_logging.md
Last active April 11, 2022 14:31
Loguru vs logging

Почему я думаю, что Loguru лучше Logging

Как говорится на главной странице Было ли вам когда-то лениво конфигурировать логгер и потому вы использовали print? У меня было так не раз. И используя loguru у вас нет причин не начинать сразу логировать.

В какой-то степени ниже будет пересказ README loguru, так что мб есть смысл почитать его. Но тут я добавляю немного сравнения со стандартными логгингом, пытаясь повторить в нем то, что умеет loguru.

TL;DR

Мне кажется, что коротко преимущества loguru описывает их оглавление:

@churnikov
churnikov / Description.md
Last active March 31, 2020 09:02
Как запускать скрипты из подмодулей

Как запускать скрипты из подмодулей

⭐ Нужна структура папок наподобие той, что ниже:

.
└── src
    ├── __init__.py
    ├── mod1
 │   ├── __init__.py
@churnikov
churnikov / one_q_priority_pass.py
Created May 26, 2021 12:47
Как можно переопределить метод start_task
class OneQPriority(OneQ):
def __init__(self, config, priority=None):
self.priority = priority
super().__init__(config)
def start_task(self, **kwargs):
kwargs["priority"] = kwargs.get("priority", self.priority)
super().start_task(**kwargs)
@churnikov
churnikov / get_client_counts.py
Last active May 26, 2021 13:09
Как получить график количества запросов с разных клиентов из логов Loki
import json
import pandas as pd
from collections import Counter
def get_logs(paths):
logs = []
for path in paths:
df = pd.read_csv(path)
for line in df.iterrows():
logs.append(json.loads(line[1][1]))
return logs
@churnikov
churnikov / Playbook
Created April 1, 2022 07:36
Playbook
У тебя спина белая))
@churnikov
churnikov / .flake8
Created April 11, 2022 10:18
How to setup pre-commit hooks
[flake8]
max-line-length = 120
inline-quotes = "
multiline-quotes = "
ignore = E203,W503
@churnikov
churnikov / README.md
Last active March 7, 2024 12:01
Ketcher and PyScript: draw molecules and use them in python

How to use molecule drawing software Ketcher and PyScript together

This small example shows how to use Ketcher and PyScript.

The process is the following: Ketcher is a JavaScript app, that has js API. PyScript allows us call this api inside of browser.

In order to setup Ketcher and PyScript on your local machine do the following:

  1. Create a new folder. E.g. pyketch;
  2. cd into it;
@churnikov
churnikov / README.md
Created August 15, 2023 18:03
stlite ketcher non-working example

I created a file using stlite and streamlit-ketcher

Unfortunately, it is not working, and I don't have time right now to figure out why. Just going to leave it here for now