Skip to content

Instantly share code, notes, and snippets.

View fonic's full-sized avatar

Fonic fonic

  • USA
View GitHub Profile
@fonic
fonic / nvidia-sensors.sh
Last active June 24, 2023 12:43
KDE KSysGuard NVIDIA GPU Sensors - see comments below for usage information
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Created by Fonic (https://github.com/fonic) -
# Date: 12/29/19 - 02/12/20 -
# -
# Created for and tested on single-GPU system equipped with NVIDIA -
# GeForce RTX 2060 SUPER. For other systems, modifications might be -
# required. -
@fonic
fonic / nvidia.sgrd
Last active June 29, 2021 19:32
KDE KSysGuard Tab for NVIDIA GPU Sensors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE KSysGuardWorkSheet>
<WorkSheet locked="0" columns="3" rows="2" title="NVIDIA" interval="2">
<host shell="" name="nvidia" command="/home/<user>/.local/share/ksysguard/nvidia-sensors.sh" port="-1"/>
<display hScale="6" stacked="0" unit="" fontSize="8" manualRange="0" version="1" vLines="0" row="0" labels="1" autoRange="1" rowSpan="1" svgBackground="" hLines="1" showUnit="0" vScroll="0" column="0" class="FancyPlotter" columnSpan="1" vDistance="30" title="Load">
<beam hostName="nvidia" color="0xff0057ae" sensorType="integer" sensorName="gpu_load"/>
<beam hostName="nvidia" color="0xffe20800" sensorType="integer" sensorName="vpu_load"/>
<beam hostName="nvidia" color="0xfff3c300" sensorType="integer" sensorName="mem_load"/>
<beam hostName="nvidia" color="0xffff0000" sensorType="integer" sensorName="pcie_load"/>
</display>
@fonic
fonic / run_command.c
Last active February 13, 2020 11:04
C Run Command Function and Wrappers (Stack Overflow: https://stackoverflow.com/q/59576159/1976617)
/**************************************************************************
* *
* C Run Command Function and Wrappers *
* *
* Related Stack Overflow question: *
* https://stackoverflow.com/q/59576159/1976617 *
* *
* Created by Fonic <https://github.com/fonic> *
* Date: 01/07/20 *
* *
@fonic
fonic / python_argparse_custom_help_usage.py
Last active September 30, 2024 10:37
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 / python_dual_log_setup.py
Last active September 27, 2024 16:16
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 / generate-udisks-device-configuration.sh
Last active June 1, 2020 08:15
Generate udisks / udisks2 device configuration
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 06/01/20 -
# -
# Based on: -
# https://petermolnar.net/article/hard-drive-spindown-clicking-noise/ -
# man 8 udisks -
@fonic
fonic / erase_wipe_partition_format_device.sh
Last active June 19, 2020 21:37
Erase/wipe, partition and format device on Linux
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Erase/wipe, partition and format device -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 06/18/20 - 06/08/20 -
# -
# -------------------------------------------------------------------------
@fonic
fonic / check_hardened_kernel_config.sh
Last active July 13, 2020 21:03
Check hardened Linux kernel configuration
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Check hardened Linux kernel configuration -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 07/13/20 -
# -
# -------------------------------------------------------------------------
@fonic
fonic / sign_kernel_modules.sh
Last active July 15, 2020 18:00
Sign Linux kernel modules
#!/usr/bin/env bash
# -------------------------------------------------------------------------------------------
# -
# Sign Linux kernel modules -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 07/13/20 - 07/15/20 -
# -
# Based on: -
@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.