Skip to content

Instantly share code, notes, and snippets.

View fonic's full-sized avatar

Fonic fonic

  • USA
View GitHub Profile
@fonic
fonic / python_pretty_print_objects.py
Last active July 15, 2023 11:38
Python pretty print arbitrary objects
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Recursively generate pretty print of arbitrary objects
def generate_pprint(obj, level_indent=" ", max_depth=None, verbose_output=True,
justify_output=True, prevent_loops=True, prevent_revisit=False,
explore_objects=True, excluded_ids=[], visited_ids=[],
path_ids=[], current_depth=0):
"""Recursively generates pretty print of arbitrary objects.
@fonic
fonic / smart-status.sh
Created September 5, 2022 06:47
smart-status.sh - Query SMART status of disk drives (SSD/HDD) using smartctl
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Fonic <https://github.com/fonic> -
# Date: 07/22/21 - 06/30/22 -
# -
# Based on: -
# Initramfs script 'initrc-init.sh', -
# 'man 8 smartctl', section 'EXIT STATUS' -
@fonic
fonic / scan-to-pdf.sh
Last active September 16, 2023 09:56
scan-to-pdf.sh - Scan documents directly to PDF file - Linux command line
Moved to https://github.com/fonic/scan2pdf
@fonic
fonic / python_dual_log_setup.py
Last active October 30, 2023 11:53
Python dual-logging setup (console and log file) supporting different log levels and colorized output
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# -
# Python dual-logging setup (console and log file), -
# supporting different log levels and colorized output -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/05/20 - 02/07/23 -
@fonic
fonic / remove-unneeded-languages.sh
Last active November 20, 2023 08:31
remove-unneeded-languages.sh - Remove unneeded languages from video files using FFmpeg
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Remove unneeded language(s) from video file -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/14/22 - 11/20/23 -
# -
# Posted as answer on StackExchange Unix & Linux: -
@fonic
fonic / python_argparse_custom_help_usage.py
Last active April 10, 2024 17:14
Python module extending class 'argparse.ArgumentParser' to support custom help/usage output (incl. example/demo)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# -
# Python Module Argument Parser -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 06/20/19 - 04/03/24 -
# -
@fonic
fonic / extract-clip-from-video.sh
Last active April 21, 2024 08:49
Extract clip from video using FFmpeg
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# -
# Extract clip from video -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/21/24 - 04/21/24 -
# -
# Source: -