Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍
<-Python

Makarov Andrey Winand

🐍
<-Python
View GitHub Profile
View requests_timeout_retry.py
# r = read_timeout_handler(self.session.get, self.url_card, params=params, timeout=[10, 20, 30])
def read_timeout_handler(func, url, timeout, retries=None, params={}, **kw):
"Retries on read timeout"
if not hasattr(timeout, '__iter__'):
timeout = [timeout] * (retries or 1)
elif retries is not None:
raise ValueError("retries specified along with list of timeouts")
for retry, tm in enumerate(timeout):
try:
@Winand
Winand / docker-compose-kafka.yml
Created Jun 21, 2022
Пример: кластер Kafka
View docker-compose-kafka.yml
# https://dimosr.github.io/kafka-docker/
version: '3.4'
services:
zookeeper:
image: 'bitnami/zookeeper:3.8'
ports:
- '2181:2181'
environment:
View extension_jupyter_test.md

Scenario (general):

1.1 Start code-server:

WORKON_HOME=~ code-server --cert --cert-host 172.30.15.137 --disable-telemetry --disable-update-check ~/_railcars

2.1 Open https://172.30.15.137:8080 in Google Chrome

3.1 Open Untitled.ipynb, run three cells: import pandas, create DataFrame, sum dataframe values

@Winand
Winand / request_retry.py
Created Mar 5, 2022
Пример обработки исключений в запросах requests
View request_retry.py
def read_timeout_handler(func, url, timeout, retries=None, params={}, **kw):
"Retries on read timeout"
if not hasattr(timeout, '__iter__'):
timeout = [timeout] * (retries or 1)
elif retries is not None:
raise ValueError("retries specified along with list of timeouts")
for retry, tm in enumerate(timeout):
try:
r = None # init
r = func(url, params=params, timeout=tm, **kw)
@Winand
Winand / skill.md
Last active Nov 28, 2021
Самый полезный навык, которому можно научиться за вечер? https://vas3k.club/question/5
View skill.md

Полезные навыки за вечер

  • Медитация - нужно много времени
  • Складывать вещи
  • GDT - get things done https://hamberg.no/gtd
  • Жонглировать тремя мячиками - координация, отдых для глаз, осанка https://jugglers.ru/uchebnik-zhonglirovaniya/kak-nauchitsya-zhonglirovat
  • Готовить сырники
  • Собственная безопасность
  • Оказание первой помощи (туториалы на YouTube) - нужно много времени
@Winand
Winand / ps_gui_form.ps1
Last active Sep 17, 2021
Проверка ввода
View ps_gui_form.ps1
$glob_var = 0
Function Generate-Form {
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# Build Form
$Form = New-Object System.Windows.Forms.Form
$Form.Text = "My Form"
View matplotlib_cell.py
import pickle
import threading
import time
import ipywidgets as widgets
import matplotlib.pyplot as plt
import numpy as np
def init_history_plot():
@Winand
Winand / join_max.py
Last active Jul 1, 2021
Соединить числа в одно максимально возможное
View join_max.py
# from functools import total_ordering
# @total_ordering
class Int(int):
def __lt__(self, other):
this, that = str(self), str(other)
YES, NO = True, False
if len(this) < len(that): # everything is vice versa
this, that = that, this
YES, NO = NO, YES
View sap_portal_params.txt
BI_COMMAND_22
BI_COMMAND_22-BI_COMMAND_TYPE CLEAR_SELECTION_STATE
BI_COMMAND_22-TARGET_DATA_PROVIDER_REF_LIST
BI_COMMAND_22-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1 DP_1
BI_COMMAND_22-CHARACTERISTIC ZVCH_NETS
BI_COMMAND_23
BI_COMMAND_23-BI_COMMAND_TYPE CLEAR_SELECTION_STATE
BI_COMMAND_23-TARGET_DATA_PROVIDER_REF_LIST
BI_COMMAND_23-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1 DP_3
BI_COMMAND_23-CHARACTERISTIC ZVCH_NETS