Skip to content

Instantly share code, notes, and snippets.

View AhmedNSane's full-sized avatar

Ahmed Anssaien AhmedNSane

View GitHub Profile
@ThioJoe
ThioJoe / DisableUSBPowerManagement.ps1
Last active June 9, 2025 07:25
PowerShell script to disable Windows power management on all currently connected serial ports, including most (if not all) USB devices and adapters.
# PowerShell script to disable Windows power management on all currently connected serial ports, including USB adapters
# In simpler terms, it prevents Windows from turning off connected serial devices to save power.
# Equivalent to right-clicking on a serial port device in Device Manager > Properties > "Power Management" Tab > Unchecking "Allow the computer to turn off this device to save power."
$hubs = Get-CimInstance -ClassName Win32_SerialPort | Select-Object Name, DeviceID, Description
$powerMgmt = Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi
foreach ($p in $powerMgmt) {
$IN = $p.InstanceName.ToUpper()
foreach ($h in $hubs) {
@lomars
lomars / wc-delay-email-notifications.php
Last active June 26, 2023 04:31 — forked from damiencarbery/wc-defer-order-emails.php
Delay WooCommerce emails - Delay WooCommerce emails for a specified time in settings (In progress).
<?php
/*
Plugin Name: Delay WooCommerce emails
Plugin URI: https://stackoverflow.com/questions/66157566/delay-woocommerce-order-processing-mail
Description: Delay WooCommerce emails for a specified time in settings.
Author: LoicTheAztec
Author URI: https://stackoverflow.com/users/3730754/loictheaztec?tab=profile
Version: 1.0
*/
@thedroidgeek
thedroidgeek / nokia-router-cfg-tool.py
Last active July 18, 2025 07:36
Nokia/Alcatel-Lucent router backup configuration tool
#!/usr/bin/env python3
#
# Nokia/Alcatel-Lucent router backup configuration tool
#
# Features:
# - Unpack/repack .cfg files generated from the backup and restore functionnality
# in order to modify the full router configuration
# - Decrypt/encrypt the passwords/secret values present in the configuration
@Maximus5
Maximus5 / get-admin.bat
Last active July 19, 2025 04:28
Sample batch to run itself elevated
@echo off
echo Checking for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
echo Permission check result: %errorlevel%
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...