This file contains 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
type Task<R> = () => Promise<R> | |
/** Execute array of promise-returning functions with provided concurrency level */ | |
async function* concurrentGen<R>(tasks: Task<R>[], concurrency: number) { | |
async function withIndex(task: Task<R>, index: number) { | |
const result = await task() | |
return { result, index } | |
} | |
const queues = tasks.splice(0, concurrency).map(withIndex) |
This file contains 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 contextlib import contextmanager | |
import os | |
import sys | |
from pprint import pprint | |
def get_python_version(venv_path: str) -> str: | |
version = "" | |
with open(os.path.join(venv_path, "pyvenv.cfg")) as cfg: |
This file contains 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
#!/bin/bash | |
cat /proc/stat | awk ' $1 == "cpu" { idle_time = $5; for (i = 2; i <= 10; i++) total_time += $i } END { print 100 - 100 * (idle_time / total_time) } ' |
This file contains 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
[tool.poetry] | |
name = "test-app" | |
version = "0.1.0" | |
description = "" | |
authors = ["Your Name <you@example.com>"] | |
readme = "README.md" | |
packages = [{include = "test_app"}] | |
[tool.poetry.dependencies] | |
python = "^3.8" |
OlderNewer