Skip to content

Instantly share code, notes, and snippets.

View rwperrott's full-sized avatar
🏠

Richard Perrott rwperrott

🏠
  • Bucks., UK
View GitHub Profile
@rwperrott
rwperrott / pond_skim.py
Created August 24, 2024 12:40
An adaption of my "with" statement support, in my typed adapting classes for Pond, to plain Pond classes.
from contextlib import contextmanager
from typing import Optional, Generator, Any
from pond import Pond, PooledObjectFactory, PooledObject
@contextmanager
def skim(pond: Pond,
factory: Optional[PooledObjectFactory] = None,
name: Optional[str] = None
@rwperrott
rwperrott / progress
Last active July 24, 2024 10:47
A bash progress bar with fine resolution and tput formatting.
#!/usr/bin/bash
#
# Based off:
# https://www.baeldung.com/linux/command-line-progress-bar
# https://ss64.com/bash/tput.html
#
BAR_CHARS=" ▏▎▍▌▋▊▉█"
BAR_SCALE=2
@rwperrott
rwperrott / LimitedExecutorServiceWrapper.java
Last active April 29, 2023 17:03 — forked from alexkasko/LimitedExecutorServiceWrapper.java
ExecutorService wrapper, limits max parallel threads
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;