Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼

Valerii Duz valeriiduz

🐼
View GitHub Profile
@valeriiduz
valeriiduz / profilers.py
Created Mar 10, 2022
Profilers for check how much time spend method or funtion
View profilers.py
import cProfile
import datetime
import logging
from functools import wraps
from inspect import isclass
from django.conf import settings
logger = logging.getLogger(__name__)
@valeriiduz
valeriiduz / django_query_debugger.py
Last active Mar 14, 2022
Django query debugger
View django_query_debugger.py
from django.db import connection, reset_queries
import time
import functools
def query_debugger(func):
@functools.wraps(func)
def inner_func(*args, **kwargs):
reset_queries()
@valeriiduz
valeriiduz / Makefile
Last active Jul 8, 2022
Makefile for manipulate docker-compose of python Dockerfile
View Makefile
include .env
export $(shell sed 's/=.*//' .env)
.PHONY: help up start stop restart status ps clean
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
up: ## Up all or c=<name> containers in foreground
docker-compose -f $(or $(DOCKER_COMPOSE_FILE), docker-compose.yml) up $(c)