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
# With root file system mounted at /oldsys: | |
# Use at own risk!! | |
find /oldsys/usr/lib -size 0 >/tmp/badlibs | |
cat /tmp/badlibs \ | |
| xargs --replace={} rpm --root /oldsys -qf "{}" \ | |
| grep -v "not owned" \ | |
| sort \ | |
| uniq \ | |
| xargs dnf -y --installroot=/oldsys reinstall |
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/python3 -ttu | |
# | |
# Class to read and parse /proc/net/dev quickly and make the data available as a dictionary | |
# and/or json. | |
# | |
# Licensed: MIT. Just use it. Technically Copyright (C) 2022 Michael T. Babcock | |
from collections import OrderedDict | |
import re |
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/bash | |
SIGFILE="myfiles-`date +%Y%m%d`.lst" | |
find -type f -exec sha256sum "{}" ";" > $SIGFILE | |
gpg --detach-sig $SIGFILE |
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/python3 | |
import sys | |
class location: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def deltax(self, other): |
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/python3 -ttu | |
# | |
# Run speedtest-cli and extract data from csv in useful format for bash scripts | |
# | |
# Copyright (C) 2022 Michael T. Babcock -- Licensed LGPL-2.0-or-later | |
import csv | |
import subprocess | |
def speedtest_parse(data): |
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/python3 -ttu | |
# Quick massage of cut'n'paste data from Royal Bank of Canada statement data: | |
import string | |
import sys | |
Months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") | |
tabcount = 0 | |
for data in sys.stdin: |
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/python3 -ttu | |
class hamming_db: | |
def __init__(self, itemlen): | |
self._itemlen = itemlen | |
self._itemlist = [] | |
# List of dictionaries, containing entries from itemlist that match | |
self._positiondb = [{} for _ in range(self._itemlen)] | |
def add(self, item): |
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 | |
# | |
# Make a local compressed copy of a backup file, typically being delivered by SSH | |
# | |
# Consider: | |
# xfsdump -l0 -M "$BACKUPNAME" -L "fullbackup" - /home | ssh $REMOTE "compressincomingbackup $BACKUPNAME" | |
# | |
# Copyright 2022 Michael T. Babcock | |
# Licensed to use freely under LGPL or MIT at user's discretion |
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/python3 -ttu | |
# | |
# Off the top of my head, per https://www.youtube.com/watch?v=QPZ0pIK_wsc | |
for number in range(1,101): | |
#print("Debug: {}".format(number)) | |
if number % 5 == 0 and number % 3 == 0: | |
print("fizz buzz") | |
continue |
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/python3 -ttu | |
# | |
# Use exiftool to read data from image and translate to Python dictionary | |
# | |
# Copyright 2021 Michael T. Babcock <mtb-code@mikebabcock.ca> | |
# Released under MIT License, enjoy | |
import sys, os | |
from subprocess import run | |
import json |
NewerOlder