This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pyiostat | |
import os | |
import time | |
from pprint import pprint | |
# https://www.kernel.org/doc/html/latest/block/stat.html | |
stat_labels_extended = [ | |
# reads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# The chip info can be found via sensors-detect in lm_sensors | |
# Driver `to-be-written': | |
# * ISA bus, address 0xa40 | |
# Chip `ITE IT8686E Super IO Sensors' (confidence: 9) | |
# Driver `it87': | |
# * ISA bus, address 0xa60 | |
# Chip `ITE IT8792E Super IO Sensors' (confidence: 9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import re | |
import sys | |
parts = [ | |
r'(?P<host>\S+)', # host %h | |
r'\S+', # indent %l (unused) | |
r'(?P<user>\S+)', # user %u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import re | |
# Reference https://stackoverflow.com/questions/7961316/regex-to-split-columns-of-an-amazon-s3-bucket-log | |
parse = re.compile(r"([^\s\"\[\]]+|\[[^\]\[]+\]|\"[^\"]+\")\s+") | |
logs = ( | |
l.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import os | |
log = logging.getLogger(__file__ if __name__ == "__main__" else __name__) | |
logging.basicConfig( | |
level=getattr(logging, os.environ.get("LOG_LEVEL", "INFO").upper()), | |
format="%(asctime)s [%(levelname)s]: %(message)s", | |
datefmt="%Y-%m-%dT%H:%M:%S%z", | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Note: many os-related methods in python3.5 don't accept | |
# pathlib.Path and require manual conversion to string, first | |
import os | |
import random | |
import re | |
import shutil | |
import subprocess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Usage: | |
./sas_devices.py - json output | |
./sas_devices.py --summary - human output with locations and serial | |
Warning: sas2ircu invocations have occassionally caused kernel | |
panics on previous FreeBSD installations | |
Related https://redmine.ixsystems.com/issues/14859 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
encrypted_file=some_file | |
cert=certificate.pem | |
openssl x509 -pubkey -noout -in $cert -out certificate.key | |
openssl rsautl -pubin -inkey certificate.key -in some_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1/bin/sh | |
# --line-buffer to prevent json from accidentally getting split in the middle | |
# -n 128 cat-ing large quantities of files is faster since the programs aren't re-invoked as often (too high and you risk not using all the threads in the final batches) | |
# -P 125% slightly over subscribe the CPU to lessen the chance of wasting cycles if something becomes blocked | |
# -q -m 4M make a small file buffer to smooth out I/O (don't make it too large as a single cat process could starve the other threads) | |
# -rc for single line per json object and "raw" output | |
# final jq is just to format and colorize the results | |
# zcat can be used to read json.gz files. This examples read off zfs compressing with zstd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up a jail | |
iocage create -r 12.1-RELEASE -n wheelhouse | |
iocage set dhcp=on bpf=on vnet=on wheelhouse | |
iocage start wheelhouse | |
# Build some wheels inside the jail | |
iocage console wheelhouse | |
env ASSUME_ALWAYS_YES=yes pkg update | |
pkg install -y python38 libzmq4 bash |