Skip to content

Instantly share code, notes, and snippets.

View mmoran0032's full-sized avatar
🥌

Mike Moran mmoran0032

🥌
View GitHub Profile
@mmoran0032
mmoran0032 / onlinevariance.py
Last active April 22, 2020 03:55
Online mean and variance calculation
from typing import Optional, Tuple, Union
import numpy as np
class OnlineVariance:
def __init__(
self,
initial_state: Optional[Tuple[Union[int, float]]] = None
) -> None:
@mmoran0032
mmoran0032 / slashes.py
Created January 4, 2020 07:26
Terminal artwork examples
import random
import shutil
from typing import Tuple
def generate_output(**kwargs) -> None:
print(create_output(*shutil.get_terminal_size(), **kwargs))
def create_output(
@mmoran0032
mmoran0032 / sparkbar.py
Last active January 24, 2020 17:47
Create unicode bar plots
from typing import List, Union
import numpy as np
def sparkbar(values: Union[List, np.ndarray], sort: bool = False) -> str:
"""
Create an inline bar plot
The bar plot will show the relative sizes of the values within the