tar cf - <files> -P | pv -s $(du -sb <files> | awk '{print $1}') | gzip > <some .tar.gz file>
where:
- `` is the root-mounted (i.e. starts with /) path to the files
"""This Python script counts words in a Markdown / LaTeX document(s). | |
Usage: | |
python3 count_words.py <filename or directory> | |
It will ignore ATX headers, LaTeX & Markdown comments, and LaTeX markup tags. | |
TODO: inline HTML, Markdown images & tables | |
""" |
class Array(object): | |
"""A list that indexes like an array [1...n] (for algorithm analysis).""" | |
def __init__(self, items: list) -> None: | |
"""Create a new array from a list.""" | |
self.items = items | |
def __repr__(self) -> str: | |
"""Return an executable string represention of `self`.""" | |
return '{}({})'.format(self.__class__.__name__, self.items) |
"""A method to calculate the number of True/False Positive/Negative guesses.""" | |
import numpy as np | |
def tpfp(predictions: np.ndarray, | |
ground_truth: np.ndarray, | |
negative: int=0.0, | |
positive: int=1.0, | |
normalize: bool=True) -> dict: | |
""" |
"""A simple method wrapping around `confusion_matrix`.""" | |
def confusion_dataframe(*args, **kwargs): | |
""" | |
Generate an sklearn confusion matrix as a DataFrame. | |
Args: | |
*args: positional args for `confusion_matrix` | |
**kwargs: keyword args for `confusion_matrix` |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
def heatmap(data, | |
size_scale:int = 100, | |
figsize: tuple = (15, 12), | |
x_rotation: int = 270, |
"""An object to show a realtime plot of the value of a discrete line.""" | |
from matplotlib import pyplot as plt | |
from matplotlib.ticker import MaxNLocator | |
class RealtimePlot(object): | |
"""A simple realtime plot to show the value of a discrete line.""" | |
def __init__(self, figsize: tuple=(4, 4)) -> None: | |
""" |
"""An implementation of the Intersection over Union (IoU) metric for Keras.""" | |
from keras import backend as K | |
def iou(y_true, y_pred, label: int): | |
""" | |
Return the Intersection over Union (IoU) for a given label. | |
Args: | |
y_true: the expected y values as a one-hot |
"""Methods to get the model name of GPUs used by TensorFlow.""" | |
from tensorflow.python.client import device_lib | |
def get_device_model(device) -> str: | |
""" | |
Return the model of a TensorFlow device. | |
Args: | |
device: the device to get the model name of |