Skip to content

Instantly share code, notes, and snippets.

@vitalysim
vitalysim / root_logger_settings.py
Created January 6, 2019 08:10 — forked from st4lk/root_logger_settings.py
Python logging settings for root logger
"""
Settings for root logger.
Log messages will be printed to console and also to log file (rotated, with
specified size). All log messages from used libraries will be also handled.
Three approaches for defining logging settings are used:
1. using logging classes directly (py25+, py30+)
2. using fileConfig (py26+, py30+)
3. using dictConfig (py27+, py32+)
Choose any variant as you like, but keep in mind python versions, that
# Divide list into chunks containing n element
def divide_chunks(l, n_elements):
for i in range(0, len(l), n_elements):
yield l[i:i + n_elements]
if __name__ == "__main__":
n = [1,2,3,4,5,6,7,8,9,10,12,13,14,15]
@vitalysim
vitalysim / asyncio_producer_consumer.py
Created January 28, 2019 20:40 — forked from akrylysov/asyncio_producer_consumer.py
Python 3 asyncio basic producer / consumer example
import asyncio
import random
q = asyncio.Queue()
async def producer(num):
while True:
await q.put(num + random.random())
await asyncio.sleep(random.random())
@vitalysim
vitalysim / cloudSettings
Last active May 3, 2021 08:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-05-03T08:38:29.605Z","extensionVersion":"v3.4.3"}
@vitalysim
vitalysim / gist:2cb9b8f753a21dc995a9b590fd029aeb
Created August 31, 2019 19:23 — forked from dualfade/gist:c09c61fa430bfb5f263f87a082de6911
Disabled Content-Disposition bypass --
REMOVE CONTENT-LENGTH --
POST --
HTML SRC --
<div class="row featurette">
<div class="col-md-12">
<h2 class="featurette-heading">Plugin Upload.<span class="text-muted"> Admins Only!</span></h2>
<p class="lead">Upload new plugins to include on this status page using the upload form below.</p>
<form action="addon-upload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="addon" />