Skip to content

Instantly share code, notes, and snippets.

View fonic's full-sized avatar

Fonic fonic

  • USA
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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. -