Skip to content

Instantly share code, notes, and snippets.

@lc-thomas
lc-thomas / multitasker.py
Created September 28, 2021 16:17
Python simple multiprocessing + asyncio - one event loop per process
from multiprocessing import Process
import asyncio as aio
import coloredlogs, logging
import time
PROCESSES = 2
COROUTINES_PER_PROCESS = 5
class Multitasker:
def __init__(self):
@lc-thomas
lc-thomas / admin.py
Last active September 25, 2023 22:15
Django custom admin site with list_display, tabular inline data, custom templates and custom view
from django.contrib import admin
from django.contrib.admin.models import LogEntry
from django.db.models import ManyToOneRel, ForeignKey, OneToOneField
from django.apps import apps
from django.contrib.auth.models import Group, User
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.conf.urls import url
# admin custom views
from . import admin_views