Skip to content

Instantly share code, notes, and snippets.

@fonic
fonic / ubcd2usb.sh
Last active Sep 23, 2020
Create bootable device from Ultimate Boot CD ISO image
View ubcd2usb.sh
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Create bootable device from Ultimate Boot CD ISO image -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 09/23/20 - 09/23/20 -
# -
# Based on: -
@fonic
fonic / python_pretty_print_objects.py
Last active Dec 31, 2020
Python pretty print arbitrary objects
View python_pretty_print_objects.py
#!/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 / sign_kernel_modules.sh
Last active Jul 15, 2020
Sign Linux kernel modules
View sign_kernel_modules.sh
#!/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 / check_hardened_kernel_config.sh
Last active Jul 13, 2020
Check hardened Linux kernel configuration
View check_hardened_kernel_config.sh
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# -
# Check hardened Linux kernel configuration -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 07/13/20 -
# -
# -------------------------------------------------------------------------
@fonic
fonic / erase_wipe_partition_format_device.sh
Last active Jun 19, 2020
Erase/wipe, partition and format device on Linux
View erase_wipe_partition_format_device.sh
#!/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 Jun 1, 2020
Generate udisks / udisks2 device configuration
View generate-udisks-device-configuration.sh
#!/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 Dec 31, 2020
Python dual-logging setup (console and log file) supporting different log levels and colorized output
View python_dual_log_setup.py
#!/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 -
@fonic
fonic / python_argparse_custom_help_usage.py
Last active Jan 18, 2021
Python argparse.ArgumentParser custom help/usage output (full example)
View python_argparse_custom_help_usage.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# -
# Python Module ArgumentParser -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 06/20/19 - 08/12/20 -
# -
@fonic
fonic / run_command.c
Last active Feb 13, 2020
C Run Command Function and Wrappers (Stack Overflow: https://stackoverflow.com/q/59576159/1976617)
View run_command.c
/**************************************************************************
* *
* 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 Oct 12, 2020
KDE KSysGuard Tab for NVIDIA GPU Sensors
View nvidia.sgrd
<?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>