Skip to content

Instantly share code, notes, and snippets.

View DrDougPhD's full-sized avatar

Doug McGeehan DrDougPhD

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC+nuVUEk0Kiv1uYAy0Tv2OLSEe8HL1nnLrJef3Aj8PZmvhVkjMzIvz027pGwO4RHFpTEkgssIC6Rz2vn4600k34aYhgrWdbcLZdDiwUiGwP8U5LyCAQxYivYK9cR0ZJ1AZwmnX4vMye/iXcp2HvGy1O2wIasWZJNwFTmXp50mVFs0fF84WNQibKPJcDsceUM81NQfBTgSLDFPj9BVwS/OQei1bDYNnaAp6TM5LcT0/Z+4k91m862Wn+qMkrWN3kh+GUotf5EehVM3UdcAXgmwPOuxskpy7sLe7GL1N5bh3LmEIGdB4/HF0hbBRYfjl0IyNwEHkSHZc8eclIPODdoaReVk57rCjgiqHhJY1J8vkcnkn6y11PtdkhWExHWXuuLEkm6iuiraam7e94BxH5macznI1xn9obDjk4nOCRMsuNV8b2y3uqESsvYGjAkxRPUt0Z7bxkKTMGbwFgCTP7/ROU23Usdxh7sdPUGcZZx0Xok3UGG90G4I63CXkd6x6yPU= doug@jaculus

Keybase proof

I hereby claim:

  • I am drdougphd on github.
  • I am drdoug (https://keybase.io/drdoug) on keybase.
  • I have a public key ASDvf1tLRDX94Aoo5GNdwBhw8Cgc-YnLJxeoJaNIBfwO_go

To claim this, I am signing this object:

@DrDougPhD
DrDougPhD / cache.py
Created October 30, 2022 17:04
Caching Decorator for Python
import os
import pathlib
import pickle
import logging
import numbers
logger = logging.getLogger(__name__)
enabled = True
@DrDougPhD
DrDougPhD / logging.py
Last active October 27, 2022 13:06
Python Color Logging
import logging
import os
import pathlib
import colorlog
default_level = 'DEBUG'
def setup(verbosity: str = default_level):
@DrDougPhD
DrDougPhD / README.md
Last active October 5, 2017 18:45
Install ruTorrent and rtorrent on OpenMediaVault 3 (Debian 8) using PHP7 and Nginx

This is incomplete. Don't follow these directions.

  1. Install rtorrent

    root@omv:~# apt-get install rtorrent -y

  2. Install PHP7 and other ruTorrent dependencies

    root@omv:# echo "deb http://packages.dotdeb.org jessie all" >>/etc/apt/sources.list.d/dotdeb-org.list root@omv:# echo "deb-src http://packages.dotdeb.org jessie all" >>/etc/apt/sources.list.d/dotdeb-org.list

@DrDougPhD
DrDougPhD / print_torrent.py
Created September 24, 2017 13:05
Print a quick summary of the files and file sizes in a BitTorrent file.
import bencoder
import sys
import os
import termcolor
def main(args):
torrent_path = args[-1]
if not os.path.isfile(torrent_path) or not torrent_path.endswith('.torrent'):
print('Usage: python {} TORRENT_PATH.torrent'.format(args[0]))
@DrDougPhD
DrDougPhD / absolutepath.py
Last active March 14, 2017 18:55
This Python function is useful for argparse declarations that receive directories that both need to be verified existing and converted to absolute paths.
'''
Copyright 2017 Doug McGeehan under the GPLv3.
'''
import os
def verified_absolute_path(path):
abs_path = os.path.abspath(path)
assert os.path.isdir(abs_path),\
@DrDougPhD
DrDougPhD / show list
Created March 7, 2017 06:39
KMNR Shows that weren't being recorded previously
Hyvää Huomenta
DJ SunMetal
Stored in /var/www/HyvaaHuomenta
................................................................................
It's Quiet Hours
DJ Undecided
Stored in /var/www/ItsQuietHours
................................................................................
The Bat Signal
DJ Batman
@DrDougPhD
DrDougPhD / lineheaderpadded.py
Last active February 13, 2017 17:43
Pretty line headers in Python - e.g. "-------------------------: Hello, World! :-------------------------"
#!/usr/bin/env python3
#
# Create pretty line headers, padded with dashes, equals, octothorpes, tildes,
# and whatever else you want.
#
# Examples:
#
# ==========================: Hello, World! :==========================
#
# ~~~~~~~~~~~~~~~: Error Messages:~~~~~~~~~~~~~~~
@DrDougPhD
DrDougPhD / recover_disk_img.sh
Last active January 19, 2017 18:44
Quick 'n' dirty script to recover a disk image and write to a drive.
#!/usr/bin/env bash
#
# Automatically recover a backup to a destination drive.
# NOTE: Must be run as root.
#
# DEPENDENCIES
#
# Lziprecover - for decompressing possibly corrupted lzip archives.
# pv - for status of writing image to drive
# smartmontools - for printing out drive info, used as safety measure to