$ sudo dd if=2020-08-20-raspios-buster-armhf.img of=/dev/sda bs=1M
$ sudo sync
- Pop out and pop SD card back in.
# Heavily inspired by the answer by Tom in https://stats.stackexchange.com/questions/89030/rand-index-calculation | |
def rand_score(labels_true, labels_pred): | |
""" | |
Args: | |
labels_true: Array of shape :math:`(N)` denoting the class identities of each element. | |
labels_pred: Array of shape :math:`(N)` denoting the cluster identities of each element. | |
Returns: | |
(Unadjusted) Rand index. |
from io import BytesIO | |
import av | |
import numpy as np | |
def video_array_to_mp4_blob(video: np.ndarray, fps: float = 24) -> bytes: | |
""" | |
Args: | |
video: Video array of shape :math:`(T, H, W, 3)` and range :math:`[0, 255]` with type ``np.uint8``. |
import argparse | |
from pathlib import Path | |
import numpy as np | |
import pandas as pd | |
parser = argparse.ArgumentParser( | |
description="", |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>title</title> | |
</head> | |
<body> | |
</body> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>title</title> | |
</head> | |
<body> | |
</body> |
def relative_symlink(target: Union[Path, str], destination: Union[Path, str]): | |
"""Create a symlink pointing to ``target`` from ``location``. | |
Args: | |
target: The target of the symlink (the file/directory that is pointed to) | |
destination: The location of the symlink itself. | |
""" | |
target = Path(target) | |
destination = Path(destination) | |
target_dir = destination.parent |
import numpy as np | |
def get_row_ranks(xs): | |
""" | |
Args: | |
xs: array of shape :math:`(N, E)` | |
Returns: | |
Ranks for each row of ``xs``. A rank of 0 is the highest value, and a rank of ``E - 1`` is the lowest value. |
#### MATPLOTLIBRC FORMAT | |
## This is a sample matplotlib configuration file - you can find a copy | |
## of it on your system in | |
## site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it | |
## there, please note that it will be overwritten in your next install. | |
## If you want to keep a permanent local copy that will not be | |
## overwritten, place it in the following location: | |
## unix/linux: | |
## $HOME/.config/matplotlib/matplotlibrc or |
# Snippet from http://jonathansoma.com/lede/data-studio/matplotlib/list-all-fonts-available-in-matplotlib-plus-samples/ | |
# Author: Jonathan Soma | |
import matplotlib.font_manager | |
from IPython.core.display import HTML | |
def make_html(fontname): | |
return "<p>{font}: <span style='font-family:{font}; font-size: 24px;'>{font}</p>".format(font=fontname) | |
code = "\n".join([make_html(font) for font in sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist]))]) |