Skip to content

Instantly share code, notes, and snippets.

# WSUS Driver Cleanup
## aka you synced the drivers to WSUS and now the database is fucked
1. If you can: decline all driver updates and run WSUS cleanup job, via the WSUS management console.
2. Connect to the Windows Internal Database named pipe via SQL Server Management Studio
a. Right-click and run SSMS as Administrator
b. Use this named pipe to connect: np:\\.\pipe\MICROSOFT##WID\tsql\query
3. Run all of these delete queries against the database, one-by-one to check for errors before running the next:
a. delete from tbrevisionlanguage where revisionid in (select revisionid from tbRevision where LocalUpdateId in (select LocalUpdateId from tbUpdate where UpdateTypeID = 'D2CB599A-FA9F-4AE9-B346-94AD54EE0629'));
delete from tbProperty where revisionid in (select revisionid from tbRevision where LocalUpdateId in (select LocalUpdateId from tbUpdate where UpdateTypeID = 'D2CB599A-FA9F-4AE9-B346-94AD54EE0629'));
<#
.SYNOPSIS
Scans one or more folders for potential duplicate files using filename similarity, fuzzy content hashing, or both.
.DESCRIPTION
This script compares files using two techniques:
• Filename similarity using the Levenshtein distance algorithm (ignores file extensions)
• Fuzzy content similarity using Context-Triggered Piecewise Hashing (CTPH) via ssdeep
@9000cats
9000cats / wg_manager.sh
Last active March 3, 2025 02:06
Wireguard & qBittorrent-nox VPN Tunnel Supervisor
#!/bin/bash
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# This is hard coded for Chicago servers only #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# Directory containing WireGuard conf files
WG_DIR="/etc/wireguard"
# IP address to ping for connectivity checks
PING_IP="8.8.8.8"
# Time interval between pings (in seconds)
PING_INTERVAL=30
@9000cats
9000cats / Excel_DNSlookup.vba
Created November 26, 2024 19:14
Excel VBA Macro for DNS Lookup Custom Formula
Private Function SingleDNSLookup(hostName As String) As String
' Check for empty or whitespace-only hostname first
If Trim(hostName) = "" Then
SingleDNSLookup = ""
Exit Function
End If
Dim wsh As Object
Dim psCommand As String
Dim result As String
@9000cats
9000cats / Run-RMANBackup.ps1
Created October 31, 2024 00:32
PowerShell script for running Oracle RMAN backups, with a full backup on Sunday and incrementals Monday-Saturday.
<#
.SYNOPSIS
Performs automated RMAN (Recovery Manager) backups of Oracle databases with comprehensive logging and monitoring.
.DESCRIPTION
This script automates Oracle RMAN backup operations with enhanced logging capabilities. It performs
either full (level 0) or incremental (level 1) backups based on the day of the week, with full
backups scheduled for Sundays. Features include:
- Detailed logging with separate files for general and detailed logs
- Process monitoring and resource usage tracking
@9000cats
9000cats / Stop-VeeamServices.ps1
Created October 16, 2024 16:11
Stops all Veeam services on Windows in reverse dependency order while displaying real-time status updates.
<#
.SYNOPSIS
This PowerShell script retrieves all active Veeam services along with their dependencies and handles their status updates.
It then processes each service in reverse dependency order to stop them gracefully, ensuring dependencies are handled correctly.
The script also provides real-time status updates for all services.
.DESCRIPTION
The script includes the following functions:
- `Get-VeeamServicesWithDependencies`: Retrieves all Veeam services that are not stopped or disabled, along with their dependencies.
- `Get-ServiceDependencies`: Returns the active dependent services for a given service.
@9000cats
9000cats / Convert-EmlToMsg.ps1
Last active November 23, 2024 21:25
PowerShell script that will convert .eml email files to .msg format, using PowerShell and .NET, and without COM objects (New Outlook doesn't support COM objects)
<#
.SYNOPSIS
This PowerShell script converts an .eml email file to a .msg format, preserving email metadata such as sender, recipients (To, CC, BCC), subject, and body (text and HTML), as well as attachments.
.DESCRIPTION
The script opens a dialog for the user to select an .eml file, reads the email using MimeKit, and converts it to a .msg format using the MsgKit library.
The script ensures that all major email components, including attachments, are properly transferred. This script requires PowerShell 7 or later.
.PARAMETER EML File
The input .eml email file to be converted.
@9000cats
9000cats / Enphase2InfluxDB.py
Created April 20, 2024 22:48
Enphase Einstein Local API (Production Meter Reading) to InfluxDB 2.x
import json
import requests
from time import sleep
from influxdb_client import InfluxDBClient
from influxdb_client.client.write_api import SYNCHRONOUS
import os
import urllib3
# Disable SSL warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)