Skip to content

Instantly share code, notes, and snippets.

View AfroThundr3007730's full-sized avatar
🔧
Hacking all the things...

Eddie Carswell AfroThundr3007730

🔧
Hacking all the things...
View GitHub Profile
@AfroThundr3007730
AfroThundr3007730 / remote-inhibitors.md
Last active June 1, 2026 14:23
Remote inhibitor template for systemd services

Remote systemd inhibitors

This setup allows for attaching inhibitors of remote systems as dependencies of systemd units.

This is especially useful when a task requires a remote system to be available to complete successfully.

This configuration can be applied both to system and user service units.

Setup

@AfroThundr3007730
AfroThundr3007730 / history-logging.sh
Last active May 25, 2026 00:38
Basic shell history logging to syslog
#!/bin/bash
# /etc/profile.d/zzz-history-logging.sh
_logger_hook() {
logger -p user.notice -t "$0" --id=$$ -- \
"${USER}${SUDO_USER:+ (sudo:$SUDO_USER)}" :: \
"${HOSTNAME%%.*}${SSH_CLIENT:+ (ssh:${SSH_CLIENT%% *})}" :: \
"${PWD}" :: "${BASH_COMMAND:-$*}"
}
@AfroThundr3007730
AfroThundr3007730 / fix_ads_perms_flags.py
Last active May 2, 2026 14:41
Python script to convert ADS ACLs dumped in JSON format to human readable syntax
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
# For issues or updated versions of this script, browse to the following URL:
# https://gist.github.com/AfroThundr3007730/958f17bce3c631df233b14a05159d194
"""Convert ADS ACLs to human readable syntax"""
__author__ = "AfroThundr"
__modified__ = "2026-04-30"
@AfroThundr3007730
AfroThundr3007730 / Set-TokenPrivilege.ps1
Created April 16, 2026 00:04
Adjust the token privileges of a process
# Source: https://www.leeholmes.com/adjusting-token-privileges-in-powershell/
Set-StrictMode -Version Latest
enum TokenPrivilege {
SeAssignPrimaryTokenPrivilege
SeAuditPrivilege
SeBackupPrivilege
SeChangeNotifyPrivilege
SeCreateGlobalPrivilege
@AfroThundr3007730
AfroThundr3007730 / Invoke-ComObject.ps1
Last active April 18, 2026 18:27
Several powershell functions to invoke methods on raw COM objects
# Several powershell functions to invoke methods on raw COM objects
# Last updated 2026-04-18 by AfroThundr
# From: https://stackoverflow.com/questions/20248032/
Set-StrictMode -Version Latest
function Invoke-ComObject {
<# .SYNOPSIS
Invoke a method on a COM object or get/set a property #>
@AfroThundr3007730
AfroThundr3007730 / report_logger.md
Last active May 11, 2026 02:47
A basic Flask server to receive network reports

Installation steps

  • Make the directory /opt/reports/logs

  • Add configuration to /opt/reports/logger.env

    FLASK_APP=report_logger
    FLASK_RUN_HOST=0.0.0.0
    FLASK_RUN_PORT=5001
@AfroThundr3007730
AfroThundr3007730 / streamlink-save.sh
Last active May 31, 2026 09:20
Save Twitch live streams via streamlink
@AfroThundr3007730
AfroThundr3007730 / gen_services_lookup.md
Last active May 27, 2026 15:32
Convert /etc/sevices to CSV lookup file

Convert /etc/sevices to CSV lookup file

out=$SPLUNK_HOME/etc/apps/search/lookups/services.csv
awk 'BEGIN {
        print "port,proto,port_name,port_desc"
    } NR > 1 && $0 !~ /^(#|\s*$)/ {
        split($2, p, "/")
        name=$1
        port=p[1]
@AfroThundr3007730
AfroThundr3007730 / zfs-module-build.service
Last active May 31, 2026 09:19
Build binary zfs-module packages for all kernel packages
[Unit]
Description=Build binary ZFS module packages and publish repo
RequiresMountsFor=/mnt/pool0/data/app /mnt/pool0/mirror/repo
[Service]
Type=exec
Restart=no
TimeoutSec=10
ExecStart=/mnt/pool0/data/app/repo/debian-zfs/bin/zfs-module-build -y
EnvironmentFile=-/mnt/pool0/data/app/repo/debian-zfs/etc/environment
@AfroThundr3007730
AfroThundr3007730 / create-pki-certs.sh
Last active January 13, 2026 15:19
Generating x509 PKI certs inline
#!/bin/bash
config='
[ca_cert]
basicConstraints=critical,CA:true,pathlen:1
authorityKeyIdentifier=keyid:always,issuer
subjectKeyIdentifier=hash
keyUsage=critical,keyCertSign,cRLSign
[sign_cert]