Skip to content

Instantly share code, notes, and snippets.

# Requires elevated (Administrator) PowerShell session
param(
[Parameter(Mandatory=$true)]
[ValidateRange(1025, 65535)]
[int]$NewRdpPort
)
# --- Configuration ---
$RdpKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
@fahadysf
fahadysf / rdp-status-check.ps1
Created December 11, 2025 15:56
Powershell Script to Diagnose any issues in Remote Desktop (Incoming) Connectivity for the host.
#Requires -RunAsAdministrator
<#
.SYNOPSIS
RDP Health Check - Diagnoses Remote Desktop Service connectivity issues
.DESCRIPTION
Checks service status, listening ports, firewall rules, NLA settings,
user permissions, and network accessibility for RDP connections.
#>
param(
@fahadysf
fahadysf / gist:67342e359f334e58841484ee9f8767a4
Created September 10, 2025 09:25
Powershell-String-Replacement.ps1
# Set the paths for your files
$replacementListFile = "C:\temp\replace.txt"
$targetFile = "C:\temp\target.xml"
# Read the contents of the replacement list file
$replacementList = Get-Content -Path $replacementListFile
# Read the content of the target file into a single string
$content = Get-Content -Path $targetFile -Raw
@fahadysf
fahadysf / ghostty.config
Created September 9, 2025 10:56
Ghostty Dark Config
font-family = "JetBrainsMono Nerd Font Mono"
font-style = Regular
font-size = 13
font-thicken = true
adjust-underline-position = 40%
adjust-underline-thickness = -60%
cursor-style = block
cursor-style-blink = false
#!/bin/sh
dnsserver=“your-dns-server.ns.cloudflare.com"
host="your-record-name"
domain_name=“yourdomain.com”
cf_user_email="[email protected]"
cf_api_key=“—get-your-own-api-key--“
cf_zone_id="—get-your-own-zone-id—“”
cf_record_id=“check-your-own-record-id”
dnsrecord=$host.$domain_name
#!/usr/bin/env python3
"""
SCTP Client/Server
Author: Fahad Yousuf
This script implements a simple SCTP client/server using Python's socket module.
The server listens on port 62324 and the client connects to the server on the same port.
"""
#!/bin/bash
#
# Script to print out the current power cycles and capacity of Macbooks
# which provide this info.
# -------
CYCLE_COUNT=`system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'`
MAX_CAPACYTY=`system_profiler SPPowerDataType | grep "Maximum Capacity" | awk '{print $3}'`
echo "Cycle Count: $CYCLE_COUNT"
@fahadysf
fahadysf / Information.md
Created January 9, 2024 13:09
Kubernetes - Cloud Native Technologies Info
@fahadysf
fahadysf / user-creator.ps1
Last active December 7, 2023 08:22
Powershell Local DB User Creator for Panorama Template
### Needed stuff
Add-Type -AssemblyName System.Web
### GLOBAL Settings
$filePath = "C:\code\usernames.txt_CHANGE_ME"
$deviceUrl = "https://panorama_ip_or_fqdn_change_me"
$username = "admin"
$templateName = "template_name_change_me"
$Debug = $true
@fahadysf
fahadysf / panos-config-backup.py
Created August 31, 2023 08:54
Simple Python script to backup the running config from PAN-OS Firewalls or Panorama
import os
import sys
import requests
import argparse
import getpass
import time
# This is a simple Python script which can be run as a Scheduled Task
# to backup the running config from PAN-OS Firewalls or Panorama. Tested to work with
# Python 3.11.5 on Mac OSX and Windows Server 2019.