This file contains hidden or 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 | |
| # Don't require DUN APN type | |
| settings put global tether_dun_required 0 | |
| # use MagiskHide Props Config | |
| # echo "net.tethering.noprovisioning=true" >> /system/build.prop | |
| # iptables increment TTL for nat packets since carriers block these | |
| # Requires kernel with CONFIG_IP_NF_TARGET_TTL enabled |
This file contains hidden or 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
| # see https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/ | |
| import requests | |
| from requests.adapters import HTTPAdapter, Retry | |
| class TimeoutHTTPAdapter(HTTPAdapter): | |
| DEFAULT_TIMEOUT = 30 | |
| def __init__(self, *args, **kwargs): |
This file contains hidden or 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 boto3 | |
| import json | |
| # assumes ASG has tag Name="ECS Cluster - cluster_name" | |
| cluster_name = "some-clsuter" | |
| asgs = [ | |
| { | |
| "name": asg["AutoScalingGroupName"], | |
| "instance_type": asg["Instances"][0]["InstanceType"], |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |