We want to have a separate ext4 boot partition because Ubuntu's grub doesn't really like booting from btrfs. So we have something like
MOUNT POINT SIZE TYPE
/ 474G new btrfs
/boot 2G new ext4
/boot/efi 1G existing vfat
| import sys | |
| import io | |
| def _text_encoding(encoding, stacklevel=2, /): # pragma: no cover | |
| return encoding | |
| try: | |
| text_encoding = io.text_encoding |
| const d6 = () => String.fromCodePoint(0x2680 + Math.floor(Math.random() * 6)) | |
| function d6() { | |
| const faceIdx = Math.floor(Math.random() * 6); | |
| const codePoint = 0x2680 + faceIdx; | |
| return String.fromCodePoint(codePoint) | |
| } |
| body { | |
| background-size: 40px 40px; | |
| background-image: | |
| linear-gradient(to right, lightblue 1px, transparent 1px), | |
| linear-gradient(to bottom, lightblue 1px, transparent 1px); | |
| } |
| import math | |
| def entropy(vec): | |
| norm = sum(vec) | |
| p = (x / norm for x in vec) | |
| return -sum(p_k * math.log(p_k) for p_k in p if p_k) | |
| import numpy as np | |
| def entropy(p): |
| function stringTruncator (numChars, buffer) { | |
| buffer = buffer || 3 | |
| return function (str) { | |
| return function (str) { | |
| let cutoff = str.slice(0, numChars).lastIndexOf(' ') | |
| if (cutoff === -1) cutoff = numChars | |
| str = str.slice(0, cutoff) + '…' | |
| } | |
| return str | |
| } |
| from collections import namedtuple | |
| DataRow = namedtuple('DataRow', ['header', 'data']) | |
| def flatten_botometer_result(result): | |
| ''' | |
| Flattens a botometer response object. | |
| Parameters: | |
| result: A botometer result object |
| #!/bin/bash | |
| set -uo pipefail | |
| IFS=$'\n\t' | |
| if [[ $# -eq 0 ]]; then | |
| echo "usage: $0 <target_directory>" | |
| exit 1 | |
| fi | |
| TARGET_DIR=$1 |
| def lrange_iter(r, key, N_max=None, step=10**5): | |
| if N_max is None: | |
| starts = itertools.count(step=step) | |
| else: | |
| starts = range(0, N_max, step) | |
| for start in starts: | |
| end = start + step - 1 | |
| if N_max is not None: | |
| end = min(end, N_max - 1) |
| import math | |
| from collections import namedtuple | |
| def haversine_distance(origin, destination): | |
| """ Haversine formula to calculate the distance between two lat/long points on a sphere """ | |
| radius = 6371 # FAA approved globe radius in km | |
| dlat = math.radians(destination.lat-origin.lat) | |
| dlon = math.radians(destination.lng-origin.lng) |