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" |
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
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
/* | |
arr - массив строк вида ["1-3","5-7","2-4","8-12","5-11"] | |
Каждая строка в массиве задает интервал [N,M], где N и M - целые числа, включая края. | |
Необходимо написать функцию сигнатуры string[] => string[], которая получает на вход подобный массив, | |
и возвращает массив строк такого же формата, в котором все перекрывающиеся интервалы оптимально склеены и отсортированы. | |
Например, в данном случае должен получиться массив ["1-4","5-12"]. | |
Необходимо учесть возможные пограничные случаи, включая невалидный формат" | |
*/ | |
function parseInterval(interval: string): { start: number; end: number } { |
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
#!/usr/bin/bash | |
function h2s() { | |
local hours=$1 | |
echo "${wait_time:0:-1} * 3600" | bc | cut -d. -f1 | |
} | |
function humanize_duration() { | |
local total_seconds=$1 | |
local hours=$(( $total_seconds / 3600 )) |
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
console.clear(); | |
enum FoldIcon { | |
folded = '+', | |
unfolded = '-' | |
} | |
interface IData { | |
id: number; | |
title: string; |
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
<div class="buttons"> | |
<button class="button__success">Success</button> | |
<button class="button__info">Info</button> | |
<button class="button__warning">Warning</button> | |
<button class="button__error">Error</button> | |
</div> |
NewerOlder