Skip to content

Instantly share code, notes, and snippets.

from collections import defaultdict
from dataclasses import dataclass
from itertools import chain, combinations, combinations_with_replacement, product
from typing import Tuple, Callable, Set, FrozenSet, Generic, TypeVar, Hashable, Iterable, Dict, Iterator
def powerset(iterable):
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
@Stepland
Stepland / EliteTMHelper.py
Last active March 17, 2024 00:56
Want to be Elite TM but don't have the time and patience to rip 500 Vinyls ? no problem.
import requests
import time
import sys
import argparse
import pickle
import json
class RedactedAPIError(Exception):
pass