Skip to content

Instantly share code, notes, and snippets.

View fsheik's full-sized avatar
🥸

Farhan Sheik fsheik

🥸
View GitHub Profile
@fsheik
fsheik / CreateRandomAzureADUsers.ps1
Created April 2, 2025 06:04
CreateRandomAzureADUsers.ps1
param (
[string]$Domain = "xyz.onmicrosoft.com", # Default domain
[string]$NamePrefix = "someprefix", # Default name prefix
[int]$UserCount = 5 # Default number of users to create
)
# Ensure you are logged in to Azure before running this script
# Connect-AzAccount
# Function to generate a random password
@fsheik
fsheik / AzPortalSetupJs.ps1
Created April 1, 2025 06:23
Azure portal fx init setup
irm https://aka.ms/portalfx/cli/setup -outfile setup.js && node .\setup.js
@fsheik
fsheik / download-dotnet-from-globaljson.ps1
Created January 28, 2025 09:19
download-dotnet-from-globaljson.ps1
# Download the dotnet-install.ps1 script
Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
# Execute the downloaded script with the desired .NET version
.\dotnet-install.ps1 -Version $((Get-Content .\global.json | ConvertFrom-Json).sdk.version)
@fsheik
fsheik / disable_checks.sql
Last active January 24, 2023 03:37
Disable foreign key validations in postgres
SET session_replication_role = 'replica';
//things
SET session_replication_role = 'origin';
@fsheik
fsheik / CreateAzureStorageEmulatorDb510.sql
Created November 6, 2022 22:01
Manually create Azure Storage Emulator SQL MDF file
CREATE DATABASE
AzureStorageEmulatorDb510
ON PRIMARY (
NAME=AzureStorageEmulatorDb510_data,
FILENAME = 'C:\Users\username\AzureStorageEmulatorDb510_data.mdf'
)
LOG ON (
NAME=AzureStorageEmulatorDb510_log,
FILENAME = 'C:\Users\username\AzureStorageEmulatorDb510_log.ldf'
)
@fsheik
fsheik / mnemonic_encoding_word_list.json
Created July 6, 2022 01:36
mnemonic encoding word list json
{
"words": [
"abraham",
"absent",
"absorb",
"absurd",
"academy",
"accent",
"acid",
"acrobat",
@fsheik
fsheik / AzSK_FastMode.ps1
Created November 12, 2019 22:39
Run a super fast AzSK Scan!
# Set this based on your machine config :)
$maxConcurrentJobs = 5
Select-AzSubscription -Subscription "<Azure_SubscriptionId_Here>"
$rgs = Get-AzResourceGroup
foreach($rg in $rgs) {
$check = $false
while ($check -eq $false) {
if ((Get-Job -State 'Running').Count -lt $maxConcurrentJobs) {
Start-Job -Name $rg.ResourceGroupName -ArgumentList $rg -ScriptBlock {
@fsheik
fsheik / CSVToPPTSlides.py
Created October 28, 2019 00:14
Create a set of PPT slides from CSV
import pptx
import time
from pptx import Presentation
from pptx.enum.text import MSO_AUTO_SIZE
def main():
outputPPTX = Presentation()
outputPPTX.slide_width = 11887200
outputPPTX.slide_height = 6686550
@fsheik
fsheik / Test-ServerSSLSupport.ps1
Last active February 8, 2024 14:55
Script to test SSL Server Support
function Test-ServerSSLSupport {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[string]$HostName,
[UInt16]$Port = 443
)
process {
$RetValue = New-Object psobject -Property @{
@fsheik
fsheik / MergePDF.py
Created October 16, 2019 14:30
Merge multiple PDF files
#!/usr/bin/env python
import sys
try:
from PyPDF2 import PdfFileReader, PdfFileWriter
except ImportError:
from pyPdf import PdfFileReader, PdfFileWriter
def pdf_cat(input_files, output_stream):
input_streams = []
try: