Skip to content

Instantly share code, notes, and snippets.

@wynsmart
wynsmart / AsyncScheduler.py
Last active May 17, 2020 07:47
AsyncIO Task Scheduler
#!/usr/bin/env python3
import asyncio
from typing import Coroutine, List
class AsyncScheduler:
@classmethod
def run(cls, tasks: List[Coroutine], limit: int = 3) -> None:
"""
@wynsmart
wynsmart / SubprocessScheduler.py
Last active April 24, 2019 20:49
Subprocess Scheduler
import typing
import subprocess
import time
import logging
class ProcessConfig(typing.NamedTuple):
cmd: typing.Any # cmd to run
stdin: typing.IO = None
stdout: typing.IO = None
@wynsmart
wynsmart / colored_print.py
Created January 18, 2017 17:17
colored terminal prints
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
@wynsmart
wynsmart / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console