Skip to content

Instantly share code, notes, and snippets.

View chris13524's full-sized avatar
🏠
Working from home

Chris Smith chris13524

🏠
Working from home
View GitHub Profile
@chris13524
chris13524 / zpool-sectors-status.sh
Created June 10, 2022 16:26
zpool status bad sectors
zpool status | while IFS=$'\n' read line; do
if [[ "$line" == *"ata-"* ]]; then
id=$(echo "$line" | grep -oP '(ata-[^\s]+)')
count=$(sudo smartctl -a /dev/disk/by-id/$id | grep Reallocated_Sector_Ct | grep -oP '(\d+)$')
echo "$line - bad sectors: $count"
else
echo "$line"
fi
done
subgridPolyfill(parent: HTMLElement, mode: "rows" | "columns") {
const go = () => {
const parentStyle = getComputedStyle(parent);
if (parentStyle.display != "grid") return;
const subgrids = Array.from(parent.children);
for (const child of subgrids) {
if (!(child instanceof HTMLElement)) throw new Error("child not instance of HtmlElement");
if (mode == "rows") {
child.style.gridTemplateRows = null;
@chris13524
chris13524 / genpass.sh
Last active September 23, 2021 18:14
Alias to generate a random 256-bit password or secret key
alias genpass="dd if=/dev/random bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev"