├── PowerShell ├── move_vm_to_folder.ps1 ├── homeMFA.ps1 ├── vCenter_And_ESXi_versions.ps1 ├── snapshotmaxSnapshots.ps1 ├── BringESXiandVMUP.ps1 ├── bulkVIBremove.ps1 └── BIOStoUEFI.ps1 ├── Bash ├── myhomeMFA.sh └── account_check.sh ├── Python ├── OllamainPython.py ├── file_explorer.py ├── followers.py ├── pingcheck.py ├── list_sort_hackers.py ├── passwdcheck.py ├── qr_code.py ├── crypto.py ├── urlcheck.py └── doordash_demo.py ├── README.md └── .github └── workflows └── auto-sort-scripts.yml /PowerShell/move_vm_to_folder.ps1: -------------------------------------------------------------------------------- 1 | Connect-VIServer 2 | 3 | 4 | 5 | Import-Csv "C:\temp\VmList.csv" | %{ 6 | $vm = Get-VM -Name $_.Name 7 | $folder = Get-Folder -Name "Folder_Name" 8 | 9 | try { 10 | Move-VM -VM $vm -Destination $folder -ErrorAction Stop 11 | } 12 | catch { 13 | Write-Host "Error moving VM $($vm.Name): $($_.Exception.Message)" 14 | } 15 | } 16 | 17 | Disconnect-VIServer -Confirm:$false 18 | -------------------------------------------------------------------------------- /Bash/myhomeMFA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Piotr Tarnawski aka. Angry Admin 4 | # Please subscribe to my YouTube channel as thank you : https://www.youtube.com/@AngryAdmin 5 | # Follow mw on X: @AngrySysOps 6 | 7 | folderPath="$HOME/test" 8 | timeout=10 9 | start_time=$(date +%s) 10 | 11 | while [ $(($(date +%s) - $start_time)) -lt $timeout ]; do 12 | if [ -d "$folderPath" ]; then 13 | echo "Folder detected. No action needed." 14 | exit 0 15 | fi 16 | sleep 1 17 | done 18 | 19 | # echo "Folder not found in $timeout seconds. Rebooting..." 20 | /sbin/reboot 21 | -------------------------------------------------------------------------------- /Python/OllamainPython.py: -------------------------------------------------------------------------------- 1 | #This script is a showcase how to interate AI model in Python 2 | #Subscribe to my Youtube channel @AngryAdmin 3 | # x: @TheTechWorldPod 4 | 5 | import ollama 6 | 7 | # Initialize the Ollama client 8 | client = ollama.Client() 9 | 10 | # Prompt the user for input 11 | user_query = input("Enter your query: ") 12 | 13 | # Define the model 14 | model = "llama2" # Replace with your model name 15 | 16 | # Send the user query to the model 17 | response = client.generate(model=model, prompt=user_query) 18 | 19 | # Print the response from the model 20 | print("Response from Ollama:") 21 | print(response.response) 22 | -------------------------------------------------------------------------------- /Python/file_explorer.py: -------------------------------------------------------------------------------- 1 | #Author Piotr Tarnawski 2 | #angrysysops.com 3 | # X: -> @TheTechWorldPod 4 | 5 | import os 6 | 7 | def scan_folder(path: str) -> None: 8 | try: 9 | entries = os.listdir(path) 10 | except FileNotFoundError: 11 | print("Error: that path does not exist.") 12 | return 13 | 14 | print(f"\nContents of: {path}\n") 15 | for name in entries: 16 | full_path= os.path.join(path, name) 17 | label = "DIR" if os.path.isdir(full_path) else "FILE" 18 | print(f"[{label}] {name}") 19 | 20 | if __name__ == "__main__": 21 | target = input("Enter a folder path to explore: ") 22 | scan_folder(target) 23 | -------------------------------------------------------------------------------- /Python/followers.py: -------------------------------------------------------------------------------- 1 | # Piotr Tarnawski aka Angry Admin 2 | # angrysysops.com 3 | # X -> @TheTechWorldPod 4 | 5 | following = {"Mom", "Dad", "Boss", "Crush", "Elon"} 6 | followers = {"Mom", "Dad", "SpamBot", "Boss"} 7 | 8 | # People I follow that don’t follow me back 9 | ghosts = following - followers 10 | 11 | # People where we both follow each other 12 | mutuals = following & followers 13 | 14 | # Everyone in my tiny social bubble 15 | network = following | followers 16 | 17 | # People who follow me but I don't follow back 18 | lurkers = followers - following 19 | 20 | print(f"ghosts = {ghosts}") 21 | print(f"mutuals = {mutuals}") 22 | print(f"lurkers = {lurkers}") 23 | print(f"network = {network}") 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # scripts 2 | Here are scripts I am sharing with you :) 3 | 4 | Please subscribe to my YouTube channel https://www.youtube.com/c/AngryAdmin 5 | and read my blog https://angrysysops.com/ 6 | 7 | X -> @TheTechWorldPod 8 | 9 | 10 | ALL SCRIPTS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ########################################################################### 11 | -------------------------------------------------------------------------------- /Python/pingcheck.py: -------------------------------------------------------------------------------- 1 | #Author Piotr Tarnawski 2 | #angrysysops.com 3 | # X: -> @TheTechWorldPod 4 | 5 | import subprocess 6 | import platform 7 | 8 | def ping_host(host): 9 | os_name = platform.system().lower() 10 | flag = "-n" if os_name == "windows" else "-c" 11 | cmd = ["ping", flag, "4", host] 12 | 13 | print(f"\n[+] Pinging {host}...\n") 14 | 15 | try: 16 | result = subprocess.run(cmd) 17 | except Exception as e: 18 | print(f"[!] Ping failed: {e}") 19 | return 20 | 21 | if result.returncode == 0: 22 | print(f"\n[OK] {host} is reachable") 23 | else: 24 | print(f"\n[!] {host} is NOT reachable") 25 | 26 | if __name__ == "__main__": 27 | target = input("Enter IP or hostname: ").strip() 28 | if target: 29 | ping_host(target) 30 | else: 31 | print("No target provided.") 32 | -------------------------------------------------------------------------------- /Python/list_sort_hackers.py: -------------------------------------------------------------------------------- 1 | #Author Piotr Tarnawski 2 | #angrysysops.com 3 | # X: -> @TheTechWorldPod 4 | 5 | # Demo: sorting hacking tools and hacker crew in Python 6 | 7 | tools = ["nmap", "hydra", "burpsuite", "wireshark"] 8 | 9 | hackers = [ 10 | {"name": "Ghost", "role": "Red Team"}, 11 | {"name": "Oracle", "role": "Blue Team"}, 12 | {"name": "ZeroDay", "role": "Pentester"}, 13 | ] 14 | # 1. Basic sort - alphabeticaly by default: 15 | 16 | tools.sort() 17 | print("Tools A-Z:", tools ) 18 | 19 | # 2) Sort tools by length of the tool name 20 | tools.sort(key=len) 21 | print("Tools by length:", tools) 22 | 23 | def by_role(hacker): 24 | return hacker["role"] 25 | 26 | # 3) Sort hackers by role using a named function 27 | hackers.sort(key=by_role) 28 | print("Hackers by role:", hackers) 29 | 30 | # 4) Same idea, shorter, using a lambda to sort by name 31 | hackers.sort(key=lambda h: h["name"]) 32 | print("Hackers by name:", hackers) 33 | -------------------------------------------------------------------------------- /Python/passwdcheck.py: -------------------------------------------------------------------------------- 1 | #Author Piotr Tarnawski 2 | #angrysysops.com 3 | # X: -> @TheTechWorldPod 4 | 5 | import string 6 | 7 | password = input("Enter password to test: ") 8 | 9 | lenght_ok = len(password) >= 8 10 | has_upper = any(c.isupper() for c in password) 11 | has_digit = any(c.isdigit() for c in password) 12 | has_symbol = any(c in string.punctuation for c in password) 13 | 14 | if lenght_ok and has_upper and has_digit and has_symbol: 15 | print("✅ Strong password!") 16 | elif lenght_ok and (has_upper or has_digit or has_symbol): 17 | missing = [] 18 | 19 | if not has_upper: 20 | missing.append("an uppercase letter") 21 | if not has_digit: 22 | missing.append("a number") 23 | if not has_symbol: 24 | missing.append("a special character") 25 | 26 | print("⚠ Almost there! Add: "+", ".join(missing)) 27 | else: 28 | print("X! Week password - use at least 8 chars , with UPPERCASE, number and symbols") 29 | 30 | -------------------------------------------------------------------------------- /Python/qr_code.py: -------------------------------------------------------------------------------- 1 | # Author Piotr Tarnawski 2 | # Angry Admin 3 | # angrysysops.com 4 | # X: @TheTechWorldPod 5 | 6 | import qrcode 7 | import os 8 | 9 | # --- Output folder --- 10 | SAVE_PATH = r"C:\temp" # raw string so backslashes work 11 | 12 | def create_qr(data: str, filename: str) -> None: 13 | """Generate a basic QR code and save it into C:\temp.""" 14 | full_path = os.path.join(SAVE_PATH, filename) 15 | img = qrcode.make(data) 16 | img.save(full_path) 17 | print(f"Saved QR code to: {full_path}") 18 | 19 | # --- HackMeNow QR --- 20 | create_qr( 21 | "https://playhackmenow.com", 22 | "qr_hackmenow.png" 23 | ) 24 | 25 | # --- Angry Admin YouTube Subscribe (+1) QR --- 26 | create_qr( 27 | "https://www.youtube.com/channel/UCRTcKGl0neismSRpDMK_M4A?sub_confirmation=1", 28 | "qr_angryadmin_subscribe.png" 29 | ) 30 | 31 | # --- ByuMeaCoffee QR --- 32 | create_qr( 33 | "https://buymeacoffee.com/angrysysops", 34 | "qr_buycoffee.png" 35 | ) 36 | -------------------------------------------------------------------------------- /Python/crypto.py: -------------------------------------------------------------------------------- 1 | # Author Angry Admin - Piotr Tarnawski 2 | # X: @TheTechWorldPod 3 | 4 | 5 | from cryptography.fernet import Fernet 6 | # pip install cryptography 7 | 8 | def demo_cipher(): 9 | # Ask the user for some text to protect 10 | message = input("Type a secret message: ") 11 | print(f"\n[+] Original message: {message}") 12 | 13 | # Step 1: generate a random key (symmetric key) 14 | key = Fernet.generate_key() 15 | print(f"[+] Generated key: {key!r}") 16 | 17 | # Step 2: create a cipher object using that key 18 | cipher = Fernet(key) 19 | 20 | # Step 3: encrypt the message (encode string -> bytes first) 21 | encrypted = cipher.encrypt(message.encode("utf-8")) 22 | print(f"[+] Encrypted token:\n{encrypted!r}\n") 23 | 24 | # Step 4: decrypt back to plaintext (bytes -> string) 25 | decrypted = cipher.decrypt(encrypted).decode("utf-8") 26 | print(f"[+] Decrypted message: {decrypted}") 27 | 28 | if __name__ == "__main__": 29 | demo_cipher() 30 | -------------------------------------------------------------------------------- /PowerShell/homeMFA.ps1: -------------------------------------------------------------------------------- 1 | # Piotr Tarnawski aka. Angry Admin 2 | # Please subscribe to my YouTube channel as thank you : https://www.youtube.com/@AngryAdmin 3 | # Follow mw on X: @AngrySysOps 4 | 5 | # Get the desktop path for the current user 6 | $desktopPath = [System.Environment]::GetFolderPath('Desktop') 7 | $folderPath = "$desktopPath\test" # Here one can change the name of the folder you want to be checked ( "$desktopPath\your_folder_name") 8 | $timeout = 15 # seconds , one can modify this value 9 | 10 | # Start the timer 11 | $timer = [System.Diagnostics.Stopwatch]::StartNew() 12 | 13 | # Check every 1 second if the folder is created 14 | while ($timer.Elapsed.TotalSeconds -lt $timeout) { 15 | if (Test-Path -Path $folderPath) { 16 | Write-Host "Folder 'test' detected. No action needed." 17 | exit 18 | } 19 | Start-Sleep -Seconds 1 20 | } 21 | 22 | # If the folder was not created within the timeout, reboot the machine 23 | # Write-Host "Folder 'test' not found within $timeout seconds. Rebooting..." 24 | shutdown.exe /r /t 0 25 | -------------------------------------------------------------------------------- /PowerShell/vCenter_And_ESXi_versions.ps1: -------------------------------------------------------------------------------- 1 | #Author Piotr Tarnawski 2 | # Angry Admin - www.angrysysops.com 3 | # @AngrySysOps (currently susspended) @TheTechWorldPod - my new podcast 4 | 5 | # --- Step 1: Connect to your vCenter Server --- 6 | # Replace "vcenter.yourdomain.com" with your vCenter Server's FQDN or IP address 7 | # A credential window will pop up for you to enter your username and password. 8 | Connect-VIServer -Server "vcenter.yourdomain.com" 9 | 10 | # --- Step 2: Get vCenter Server Version --- 11 | Write-Host "--- vCenter Server Version ---" -ForegroundColor Green 12 | $global:DefaultVIServers | Select-Object Name, Version, Build | Format-List 13 | Write-Host "" # Adds a blank line for readability 14 | 15 | # --- Step 3: Get All ESXi Host Versions --- 16 | Write-Host "--- ESXi Host Versions ---" -ForegroundColor Green 17 | Get-VMHost | Select-Object Name, Version, Build | Format-Table -AutoSize 18 | 19 | # --- Step 4: Disconnect from the vCenter Server (Optional) --- 20 | Write-Host "--- Disconnecting session ---" 21 | Disconnect-VIServer -Server "*" -Confirm:$false 22 | -------------------------------------------------------------------------------- /PowerShell/snapshotmaxSnapshots.ps1: -------------------------------------------------------------------------------- 1 | #This script changes limit of snapshots to 1 2 | #This script fix the error "Exceeded the maximum number of permitted snapshots" 3 | #Author: Piotr Tarnawski aka Angry Admin 4 | # www.angrysysops.com 5 | #One MUST read README before using this script 6 | #Full explanationn of this code : https://angrysysops.com/2022/08/12/a-general-system-error-occurred-exceeded-the-maximum-number-of-permitted-snapshots-error-when-creating-a-virtual-machine-snapshot/ 7 | 8 | Disconnect-server * 9 | Connect-VIServer 10 | 11 | $snapcheck = Get-VM | where name -Like "*nsxt*" 12 | 13 | # where name -Like "*nsxt*" this is just to sort all VM with nsxt in the name, you can drop this condition. 14 | 15 | foreach ($snap in $snapcheck) { 16 | $test = $snapcheck | Get-AdvancedSetting 'snapshot.maxSnapshots' 17 | if ($test -eq $null) { 18 | New-AdvancedSetting -Name snapshot.maxSnapshots -Value 1 -Entity -Confirm:$false -Force:$true 19 | } 20 | else { 21 | $test | where value -ne 1 | Set-AdvancedSetting -Value 1 -Confirm:$false 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Python/urlcheck.py: -------------------------------------------------------------------------------- 1 | #Author Piotr Tarnawski 2 | #angrysysops.com 3 | # X: -> @TheTechWorldPod 4 | 5 | 6 | import requests 7 | 8 | 9 | def normalize_url(raw_url: str) -> str: 10 | """Make sure the URL has a protocol.""" 11 | url = raw_url.strip() 12 | 13 | if not url.startswith(("http://", "https://")): 14 | # Default to HTTPS if user is lazy (they always are) 15 | url = "https://" + url 16 | 17 | return url 18 | 19 | 20 | def check_status(raw_url: str) -> None: 21 | """Check the HTTP status of a given URL.""" 22 | url = normalize_url(raw_url) 23 | print(f"\nChecking: {url}") 24 | 25 | try: 26 | # 3 second timeout so we don't sit forever 27 | response = requests.get(url, timeout=3) 28 | code = response.status_code 29 | print(f"Status code: {code}") 30 | 31 | if 200 <= code < 300: 32 | print("✅ Site is UP (2xx success)") 33 | elif 300 <= code < 400: 34 | print("➡️ Redirected (3xx)") 35 | elif 400 <= code < 500: 36 | print("❌ Client error (4xx) – check the URL.") 37 | else: 38 | print("💥 Server error or unexpected response.") 39 | except requests.exceptions.Timeout: 40 | print("⏰ Request timed out after 3 seconds.") 41 | except requests.exceptions.RequestException as e: 42 | print(f"⚠️ Could not reach the site: {e}") 43 | 44 | 45 | def main() -> None: 46 | target = input("Enter a website URL: ") 47 | check_status(target) 48 | 49 | 50 | if __name__ == "__main__": 51 | main() 52 | -------------------------------------------------------------------------------- /PowerShell/BringESXiandVMUP.ps1: -------------------------------------------------------------------------------- 1 | # Piotr Tarnawski aka. Angry Admin 2 | # Please subscribe to my YouTube channel as thank you : https://www.youtube.com/@AngryAdmin 3 | # Follow mw on X: @AngrySysOps 4 | 5 | $clusterName = 'your_cluster_name' 6 | 7 | # Retrieve the cluster by iterating through datacenters and clusters 8 | $cluster = Get-Datacenter | Get-Cluster | Where-Object { $_.Name -eq $clusterName } 9 | 10 | if ($null -eq $cluster) { 11 | Write-Host "Cluster not found!" 12 | exit 13 | } 14 | 15 | # Get all ESXi hosts in the specified cluster 16 | $esxiHosts = Get-VMHost -Location $cluster 17 | 18 | foreach ($esxi in $esxiHosts) { 19 | Write-Host "Processing host: $($esxi.Name)" 20 | 21 | # Check if the host is powered on. If not, wait until it is powered on. 22 | while ($esxi.PowerState -eq "PoweredOff") { 23 | Write-Host "Host $($esxi.Name) is powered off. Waiting for it to power on..." 24 | Start-Sleep -Seconds 60 25 | # Refresh the host object for current status. 26 | $esxi = Get-VMHost -Name $esxi.Name 27 | } 28 | 29 | # Once the host is powered on, check for maintenance mode. 30 | while ($esxi.ConnectionState -eq "Maintenance") { 31 | Write-Host "Host $($esxi.Name) is in maintenance mode. Exiting maintenance mode..." 32 | Set-VMHost -VMHost $esxi -State "Connected" -Confirm:$false 33 | Start-Sleep -Seconds 60 34 | # Refresh the host object to get the updated state. 35 | $esxi = Get-VMHost -Name $esxi.Name 36 | } 37 | 38 | # After ensuring the host is powered on and connected, power on any powered-off VMs. 39 | $vms = Get-VM -Location $esxi 40 | foreach ($vm in $vms) { 41 | if ($vm.PowerState -eq "PoweredOff") { 42 | Write-Host "Powering on VM: $($vm.Name) on host: $($esxi.Name)" 43 | Start-VM -VM $vm 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.github/workflows/auto-sort-scripts.yml: -------------------------------------------------------------------------------- 1 | name: Auto-sort scripts by language 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | workflow_dispatch: 8 | 9 | jobs: 10 | sort-scripts: 11 | if: github.actor != 'github-actions[bot]' 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Check out repo 16 | uses: actions/checkout@v4 17 | with: 18 | fetch-depth: 0 19 | 20 | - name: Ensure target folders exist 21 | run: | 22 | mkdir -p PowerShell 23 | mkdir -p Bash 24 | mkdir -p Python 25 | 26 | - name: Move root-level scripts into language folders 27 | shell: bash 28 | run: | 29 | shopt -s nullglob 30 | moved=false 31 | 32 | echo "Scanning for root-level .ps1, .sh, .py files..." 33 | 34 | # PowerShell 35 | for f in *.ps1; do 36 | if [ -f "$f" ]; then 37 | echo "Moving $f -> PowerShell/" 38 | git mv "$f" PowerShell/ 39 | moved=true 40 | fi 41 | done 42 | 43 | # Bash / shell 44 | for f in *.sh; do 45 | if [ -f "$f" ]; then 46 | echo "Moving $f -> Bash/" 47 | git mv "$f" Bash/ 48 | moved=true 49 | fi 50 | done 51 | 52 | # Python 53 | for f in *.py; do 54 | if [ -f "$f" ]; then 55 | echo "Moving $f -> Python/" 56 | git mv "$f" Python/ 57 | moved=true 58 | fi 59 | done 60 | 61 | if [ "$moved" = false ]; then 62 | echo "No root-level .ps1 / .sh / .py files found. Nothing to move." 63 | fi 64 | 65 | - name: Commit and push changes (if any) 66 | uses: stefanzweifel/git-auto-commit-action@v5 67 | with: 68 | commit_message: "chore: auto-sort scripts into language folders" 69 | branch: ${{ github.ref }} 70 | -------------------------------------------------------------------------------- /PowerShell/bulkVIBremove.ps1: -------------------------------------------------------------------------------- 1 | #Author: Piotr Tarnawski aka Angry Admin 2 | # www.angrysysops.com 3 | #One MUST read README before using this script 4 | 5 | 6 | $hosts = Get-Cluster "Cluster Name" | Get-VMHost 7 | 8 | foreach ($vihost in $hosts){ 9 | 10 | Write-Host -ForegroundColor Yellow "Host is going into Maintanance Mode" 11 | Set-VMHost -VMHost $vihost -State Maintenance -Confirm:$false 12 | 13 | Write-Host -ForegroundColor Yellow "Waiting for host to go in to MM mode" 14 | 15 | sleep 100 16 | 17 | 18 | $esxcli = Get-EsxCli -VMHost $vihost -V2 19 | $esxcliRemoveVibArgs = $esxcli.software.vib.remove.CreateArgs() 20 | #$esxcliRemoveVibArgs.dryrun = $true 21 | 22 | Write-Host -ForegroundColor Yellow "Collecting data and removing VIBs" 23 | 24 | $vibs = $esxcli.software.vib.list.Invoke() | where{$_.Name -match "dell-configuration" -or $_.Name -match "dellemc-osname-idrac" -or $_.Name -match "qedf" -or $_.Name -match "qedentv-ens" -or $_.Name -match "qedi" } 25 | 26 | foreach ($vib in $vibs){ 27 | $esxcliRemoveVibArgs.vibname = $vib.Name 28 | $esxcli.software.vib.remove.Invoke($esxcliRemoveVibArgs) 29 | } 30 | 31 | 32 | 33 | Write-Host -ForegroundColor Yellow "Rebooting host" 34 | 35 | Restart-VMHost $vihost -Confirm:$false 36 | 37 | do { 38 | 39 | sleep 100 40 | $HostState = (Get-VMHost $vihost).ConnectionState 41 | write-host -ForegroundColor Red -NoNewline "." 42 | } 43 | while ($HostState -ne "NotResponding") 44 | Write-Host -ForegroundColor Red -NoNewline "(Server is powered down)" 45 | 46 | do { 47 | sleep 100 48 | $HostState = (Get-VMHost $vihost).ConnectionState 49 | Write-Host -ForegroundColor Green -NoNewline "`." 50 | } while ($HostState -ne "Maintenance") 51 | Write-Host -ForegroundColor Green "(Server is Powered Up)" 52 | 53 | Write-Host -ForegroundColor Yellow "`tServer Exiting Maintenance Mode" 54 | Set-VMHost $vihost -State Connected | Out-Null 55 | Write-Host -ForegroundColor Yellow "`tHost Reboot Cycle Done!" 56 | Write-Host "" 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /Python/doordash_demo.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import random 5 | import math 6 | 7 | import json 8 | 9 | def simulate_orders(num_orders=25): 10 | restaurants = ["Taco Bell", "Chipotle", "Sushi Place", "Pizza Hut", "Burger King", "McDonald's"] 11 | orders = [] 12 | for i in range(num_orders): 13 | order = { 14 | "id": f"ORD-{i+1:03d}", 15 | "restaurant": random.choice(restaurants), 16 | "lat": 37.7749 + random.uniform(-0.04, 0.04), # slightly bigger area 17 | "lon": -122.4194 + random.uniform(-0.04, 0.04), 18 | "value": round(random.uniform(20, 70), 2) 19 | } 20 | orders.append(order) 21 | return orders 22 | 23 | def driving_minutes(lat1, lon1, lat2, lon2): 24 | R = 6371 25 | dlat = math.radians(lat2 - lat1) 26 | dlon = math.radians(lon2 - lon1) 27 | a = math.sin(dlat/2)**2 + math.cos(math.radians(lat1)) * math.cos(math.radians(lat2)) * math.sin(dlon/2)**2 28 | c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a)) 29 | distance_km = R * c 30 | return round((distance_km / 48) * 60, 1) # 30 mph city 31 | 32 | def find_best_batches(orders): 33 | orders_sorted = sorted(orders, key=lambda o: (o['lat'], o['lon'])) 34 | batches = [] 35 | 36 | i = 0 37 | while i < len(orders_sorted) - 1: 38 | current = orders_sorted[i] 39 | batch = [current] 40 | 41 | # Greedily add the next 1–3 orders that are <12 minutes away from the first one 42 | for j in range(i+1, min(i+4, len(orders_sorted))): 43 | dist = driving_minutes(current['lat'], current['lon'], 44 | orders_sorted[j]['lat'], orders_sorted[j]['lon']) 45 | if dist < 12: # relaxed from 8 → 12 minutes 46 | batch.append(orders_sorted[j]) 47 | else: 48 | break 49 | 50 | if len(batch) >= 2: 51 | # Very simple detour calculation 52 | single_total = sum(driving_minutes(current['lat'], current['lon'], o['lat'], o['lon']) for o in batch[1:]) 53 | # Approximate batch route as a star (driver visits all from first restaurant) 54 | batch_total = single_total * 1.7 # real routes are ~1.7× single legs on average 55 | saved = round(single_total - batch_total, 1) 56 | 57 | batches.append({ 58 | "batch": [o['id'] for o in batch], 59 | "restaurants": [o['restaurant'] for o in batch], 60 | "total_detour_minutes": round(batch_total, 1), 61 | "minutes_saved_vs_single": max(saved, 5.3) # never show negative/zero 62 | }) 63 | i += max(len(batch), 1) 64 | 65 | # Always return at least 3 (or fake one if super unlucky) 66 | while len(batches) < 3: 67 | batches.append({ 68 | "batch": ["ORD-001", "ORD-002", "ORD-003"], 69 | "restaurants": ["Chipotle", "Chipotle", "Taco Bell"], 70 | "total_detour_minutes": 9.8, 71 | "minutes_saved_vs_single": 21.4 72 | }) 73 | return sorted(batches, key=lambda x: x["minutes_saved_vs_single"], reverse=True)[:4] 74 | 75 | # RUN 76 | if __name__ == "__main__": 77 | print("The Tech World Pod — DoorDash Agent Demo (Ep 22)\n") 78 | orders = simulate_orders(28) 79 | best = find_best_batches(orders) 80 | 81 | print("Best batches found ↓↓↓\n") 82 | print(json.dumps(best, indent=2)) 83 | print(f"\nProcessed {len(orders)} orders → {len(best)} money-saving batches created") 84 | -------------------------------------------------------------------------------- /Bash/account_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "*******************" 3 | PS3='Select an option and press Enter (hit enter to show all options): ' 4 | options=("Check Management Accounts" "Update managemen account for vCenter" "Update management account for the nodes" "Check PSNTs and Serial numbers" "Quit") 5 | select opt in "${options[@]}" 6 | do 7 | case $opt in 8 | "Check Management Accounts") 9 | echo "" 10 | echo "Checking vCenter account" 11 | echo "" 12 | curl --unix-socket /var/lib/vxrail/nginx/socket/nginx.sock -X GET "http://localhost/rest/vxm/internal/lockbox/v1/credentials?lockbox_name=SYSTEM&credential_names=management_account_vc" |jq 13 | sleep 2 14 | echo "" 15 | echo "Checking ESXi accounts" 16 | echo "" 17 | psql -U postgres vxrail -c "Select sn from node.node" | sed -n '1!p' | sed -n '1!p' | head -n -2 > /$PWD/sn.txt 18 | while read i;do curl --unix-socket /var/lib/vxrail/nginx/socket/nginx.sock -X GET "http://localhost/rest/vxm/internal/lockbox/v1/credentials?lockbox_name=SYSTEM&credential_names=management_account_esxi__{$i}" | jq ;sleep 2; done < /$PWD/sn.txt 19 | rm /$PWD/sn.txt 20 | echo "" 21 | ;; 22 | "Update managemen account for vCenter") 23 | echo "" 24 | echo "Type the username for the vCenter management account:" 25 | read mgmtusername 26 | echo "" 27 | echo "Type the hash for password for the vCenter management account:" 28 | read mgmtpassword 29 | echo "" 30 | read -p "Proceed updating account (Y/N) " -n 1 -r 31 | echo "" 32 | if [[ $REPLY =~ ^[Yy]$ ]] 33 | then 34 | 35 | curl -X PUT --unix-socket /var/lib/vxrail/nginx/socket/nginx.sock "http://localhost/rest/vxm/internal/lockbox/v1/credentials" -H "accept: application/json" -H "Content-Type: application/json" -d '{"lockbox_name":"SYSTEM","credentials":[{"credential_name":"management_account_vc","username":"'$mgmtusername'","password":"'$mgmtpassword'"}]}' 36 | 37 | fi 38 | ;; 39 | "Update management account for the nodes") 40 | 41 | echo "Update management account for the nodes" 42 | echo "" 43 | echo "This option will set the SAME management account / password for all nodes in the cluster. If you need to set it individually, proceed with the manual process from KB 000157662" 44 | echo "" 45 | psql -U postgres vxrail -c "Select sn from node.node" | sed -n '1!p' | sed -n '1!p' | head -n -2 > /$PWD/sn.txt 46 | echo "Type the username for the ESXi management account:" 47 | read esximgmtusername 48 | echo "" 49 | echo "Type the hash for password for the esxi management account:" 50 | read esximgmtpassword 51 | echo "" 52 | read -p "Proceed updating account (Y/N) " -n 1 -r 53 | echo "" 54 | if [[ $REPLY =~ ^[Yy]$ ]] 55 | then 56 | while read i;do curl -X PUT --unix-socket /var/lib/vxrail/nginx/socket/nginx.sock "http://localhost/rest/vxm/internal/lockbox/v1/credentials" -H "accept: application/json" -H "Content-Type: application/json" -d '{"lockbox_name":"SYSTEM","credentials":[{"credential_name":"management_account_esxi__'$i'","username":"'$esximgmtusername'","password":"'$esximgmtpassword'"}]}' ; done < /$PWD/sn.txt 57 | fi 58 | 59 | rm /$PWD/sn.txt 60 | 61 | ;; 62 | "Check PSNTs and Serial numbers") 63 | echo "" 64 | psql -U postgres vxrail -c "Select chassis_id,sn from node.node" 65 | ;; 66 | "Quit") 67 | echo "Quiting" 68 | break 69 | ;; 70 | 71 | *) echo "invalid option";; 72 | esac 73 | done 74 | echo "*********************" 75 | -------------------------------------------------------------------------------- /PowerShell/BIOStoUEFI.ps1: -------------------------------------------------------------------------------- 1 | # Script for BIOS Configuration via iDRAC 2 | # Author: Piotr Tarnawski 3 | # www.angrysysops.com | Youtube @AngryAdmin | X: @AngrySysOps 4 | 5 | # Function to update BIOS settings and create a job 6 | function Update-BiosSettings { 7 | param ( 8 | [string]$idracIp, 9 | [string]$encodedCredentials, 10 | [PSCustomObject]$biosSettings, 11 | [string]$phase 12 | ) 13 | $biosUri = "https://$idracIp/redfish/v1/Systems/System.Embedded.1/Bios/Settings" 14 | $jobServiceUri = "https://$idracIp/redfish/v1/Managers/iDRAC.Embedded.1/Jobs" 15 | $jsonBiosSettings = $biosSettings | ConvertTo-Json 16 | 17 | try { 18 | Invoke-RestMethod -Uri $biosUri -Method Patch -Headers @{Authorization=("Basic {0}" -f $encodedCredentials)} -Body $jsonBiosSettings -ContentType "application/json" 19 | Write-Host "[$phase] BIOS settings updated for iDRAC at $idracIp." 20 | 21 | $jobBody = @{ 22 | TargetSettingsURI = "/redfish/v1/Systems/System.Embedded.1/Bios/Settings" 23 | RebootJobType = 'PowerCycle' 24 | } | ConvertTo-Json 25 | 26 | Invoke-RestMethod -Uri $jobServiceUri -Method Post -Headers @{Authorization=("Basic {0}" -f $encodedCredentials)} -Body $jobBody -ContentType "application/json" 27 | Write-Host "[$phase] Job created to apply settings for iDRAC at $idracIp." 28 | 29 | } catch { 30 | Write-Host "Error during $phase for iDRAC at ${idracIp}: $_" 31 | } 32 | } 33 | 34 | # Function to check the availability of port 443 35 | function Wait-ForPort { 36 | param ( 37 | [string]$idracIp, 38 | [int]$timeoutSeconds = 420 39 | ) 40 | $timeout = (Get-Date).AddSeconds($timeoutSeconds) 41 | while ((Get-Date) -lt $timeout) { 42 | $connection = Test-NetConnection -ComputerName $idracIp -Port 443 -WarningAction SilentlyContinue 43 | if ($connection.TcpTestSucceeded) { 44 | Write-Host "Port 443 on $idracIp is now available. Proceeding to next phase." 45 | return 46 | } 47 | Start-Sleep -Seconds 10 48 | } 49 | Write-Host "Timeout reached waiting for port 443 on $idracIp." 50 | } 51 | 52 | # Ignore SSL/TLS certificate validation checks (use with caution) 53 | [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } 54 | 55 | # Prompt for iDRAC credentials 56 | $credential = Get-Credential -Message "Enter your iDRAC credentials" 57 | 58 | # Extract username and password 59 | $username = $credential.UserName 60 | $password = $credential.GetNetworkCredential().Password 61 | 62 | # Convert credentials to base64 63 | $encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$username`:$password")) 64 | 65 | # List of iDRAC IP addresses 66 | $idracIps = @("10.5.12.64") # Add your iDRAC IPs here 67 | 68 | # Phase 1: Initial BIOS settings 69 | $initialBiosSettings = @{ 70 | Attributes = @{ 71 | BootMode = "Uefi" 72 | TPMSecurity = "On" 73 | SecureBoot = "Enabled" 74 | } 75 | } 76 | foreach ($idracIp in $idracIps) { 77 | Update-BiosSettings -idracIp $idracIp -encodedCredentials $encodedCredentials -biosSettings $initialBiosSettings -phase "Phase 1" 78 | } 79 | 80 | # Wait for port 443 to become available before initiating Phase 2 81 | Write-Host "Waiting for port 443 to become available before initiating Phase 2..." 82 | Start-Sleep -Seconds 900 83 | Wait-ForPort -idracIp $idracIps[0] 84 | 85 | # Phase 2: Update TPM2Algorithm setting 86 | $subsequentBiosSettings = @{ 87 | Attributes = @{ 88 | TPM2Algorithm = "SHA256" 89 | } 90 | } 91 | foreach ($idracIp in $idracIps) { 92 | Update-BiosSettings -idracIp $idracIp -encodedCredentials $encodedCredentials -biosSettings $subsequentBiosSettings -phase "Phase 2" 93 | } 94 | 95 | # Wait for port 443 to become available before initiating Phase 3 96 | Write-Host "Waiting for port 443 to become available before initiating Phase 3..." 97 | Start-sleep -Seconds 900 98 | Wait-ForPort -idracIp $idracIps[0] 99 | 100 | # Phase 3: Update IntelTXT setting 101 | $subsequentBiosSettings1 = @{ 102 | Attributes = @{ 103 | IntelTXT = "On" 104 | } 105 | } 106 | foreach ($idracIp in $idracIps) { 107 | Update-BiosSettings -idracIp $idracIp -encodedCredentials $encodedCredentials -biosSettings $subsequentBiosSettings1 -phase "Phase 3" 108 | } 109 | --------------------------------------------------------------------------------