Skip to content

Instantly share code, notes, and snippets.

View dimastbk's full-sized avatar
🍑

Dmitriy dimastbk

🍑
View GitHub Profile
@dimastbk
dimastbk / docker-compose.base.yml
Last active July 9, 2024 15:40
traefik + portainer for docker swarm (and simple app with nginx)
version: "3.8"
services:
traefik:
image: traefik:v2.4.9
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
ports:
@dimastbk
dimastbk / throttling.py
Created September 22, 2021 03:24
ratelimit with redis and zrange
from __future__ import annotations
from django.conf import settings
from django.utils import timezone
from rest_framework import throttling
from django_redis import get_redis_connection
from django_redis.client import DefaultClient
from ipware import get_client_ip