This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /var/log/supervisor/*.log { | |
| weekly | |
| rotate 52 | |
| compress | |
| delaycompress | |
| notifempty | |
| missingok | |
| copytruncate | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [DEFAULT] | |
| ; Operation mode | |
| ; This is a global value for all sections | |
| mode = master | |
| [server] | |
| ; Connection lifetime | |
| timeout = 3600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| from asyncio.queues import Queue | |
| TERMINATOR = object() | |
| class TaskPool(object): | |
| def __init__(self, loop, num_workers): | |
| self.loop = loop | |
| self.tasks = Queue(loop=self.loop) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| from collections import deque | |
| class AsyncioPool: | |
| def __init__(self, concurrency, loop=None): | |
| """ | |
| @param loop: asyncio loop | |
| @param concurrency: Maximum number of concurrently running tasks | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get update && sudo apt-get install sox libsox-fmt-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This gist shows how to run asyncio loop in a separate thread. | |
| It could be useful if you want to mix sync and async code together. | |
| Python 3.7+ | |
| """ | |
| import asyncio | |
| from datetime import datetime | |
| from threading import Thread | |
| from typing import Tuple, List, Iterable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "os" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from glob import glob | |
| import multiprocessing | |
| from concurrent.futures import ProcessPoolExecutor | |
| import cv2 | |
| from PIL import Image | |
| import imagehash | |
| from tqdm import tqdm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "test" | |
| version = "0.1.0" | |
| authors = ["YOU <YOU@users.noreply.github.com>"] | |
| edition = "2018" | |
| [lib] | |
| crate-type = ["cdylib"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import uuid | |
| class PrintRandom(object): | |
| def execute(self) -> None: | |
| while True: | |
| self.print_number(uuid.uuid1().int) | |
| time.sleep(1) |
OlderNewer