Skip to content

Instantly share code, notes, and snippets.

View ShilGen's full-sized avatar
🥷
Timelord of tech, juggling backend spells and marketing charms

Shilov Gennady ShilGen

🥷
Timelord of tech, juggling backend spells and marketing charms
View GitHub Profile
@ShilGen
ShilGen / Docker.md
Last active May 8, 2025 23:56
Docker

Docker logo

Установка Docker

sudo apt update
sudo usermod -aG docker shilgen
sudo apt install -y docker.io

Установка Docker Compose

ШАГ 1: Настроить SSH-доступ к VPS

GitHub Actions будет деплоить проект через SSH, поэтому нам нужно создать ключ и добавить его на сервер.

1.1. Создать SSH-ключ

На локальном ПК выполни:

ssh-keygen -t rsa -b 4096 -C "github-deploy-key"

Нажми Enter несколько раз, не вводя пароль.

@ShilGen
ShilGen / wb_advco_fullstats.py
Created January 19, 2025 01:36 — forked from MikyPo/wb_advco_fullstats.py
Получение статистики рек.кампаний через Wildberries API
# Developed by MikyPo
# More code for DA here: https://dzen.ru/mikypo
# Библиотеки
import requests
import json
import time
import pandas as pd
import datetime
import locale

Пример структуры проекта:

project-root/
├── .github/
│   └── workflows/
│       └── python-tests.yml
├── tests/
│   ├── test_example.py
│   └── test_another.py
├── requirements.txt

Промпт:

ты профессиональный программист на python3 используй стек технологий - python3 pandas у тебя есть 2 ексель файла в первом - список артикулов и штрихкодов во втором - фид из маркетплейса

Задача: напиши код на языке python3 который во втором файле оставит строки с артикулами какие есть в первом файле

Объяснение:

Для создания сводной таблицы по продажам в разрезе брендов по месяцам с использованием Pandas, нужно выполнить следующие шаги:

* Загрузить данные из двух Excel-файлов: с заказами и с ассортиментом.
* Преобразовать столбец с датами в формат даты.
* Объединить данные по столбцу "Артикул" (ключ для объединения).
* Добавить вычисляемые столбцы, такие как месяц и год.
* Создать сводную таблицу по брендам и месяцам.
* Сохранить результат в новый Excel файл.

Описание шагов:

@ShilGen
ShilGen / FastAPI_ws.py
Created October 20, 2024 19:18
Simple FastAPI app with websocket exchange
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from fastapi.responses import HTMLResponse
from typing import List
import python_multipart
app = FastAPI()
# Класс для управления подключениями WebSocket
class ConnectionManager:
def __init__(self):
@ShilGen
ShilGen / time_it.py
Created August 21, 2024 20:12
Python3 Decorator for measure time of function's execution
import time
def time_it(func):
def wrapper(*args,**kwargs):
start_time = time.time()
result =func(*args, **kwargs)
end_time = time.time()
print(f"Function {func.__name__} took {end_time - start_time:.4f} seconds")
return result
return wrapper

50 Coding Laws That Would Make You A Decent Programmer.

Follow these laws or get fired.

Alexander obidiegwu

There are hundreds or probably thousands of Python best practices out there and depending on who you ask, you would get some slight variation on a given practice.

The internet has given everyone the right to voice an opinion. Including even me. But in this article, we will be dealing with 50 Python best practices that are set in stone.

@ShilGen
ShilGen / Fast_API_deploy.md
Last active May 27, 2025 08:15
how to deploy fast-api on ubuntu 22.04 for real project? (step-by-step tutorial)

Deploy a FastAPI app on Ubuntu 22.04 VPS

Ubuntu Nginx Gunicorn Python FastAPI

Deploying a FastAPI application on Ubuntu 22.04 for a real project involves several steps, including setting up the server, installing necessary software, configuring the application, and setting up a reverse proxy. Here's a step-by-step tutorial