Skip to content

Instantly share code, notes, and snippets.

Fan Yang wynsmart

Block or report user

Report or block wynsmart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wynsmart
wynsmart / AsyncScheduler.py
Last active Sep 12, 2019
AsyncIO Task Scheduler
View AsyncScheduler.py
#!/usr/bin/env python3
import asyncio
from typing import Coroutine, List
class AsyncScheduler:
@classmethod
def run(cls, tasks: List[Coroutine], limit: int = 3):
"""
@wynsmart
wynsmart / SubprocessScheduler.py
Last active Apr 24, 2019
Subprocess Scheduler
View SubprocessScheduler.py
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 Jan 18, 2017
colored terminal prints
View colored_print.py
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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.