This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ChatGPT generated code. | |
# TIO.RUN example: https://tinyurl.com/33erc3yu | |
# Define fixed weights and biases for reproducibility | |
# Weights for Input Layer to Hidden Layer (W1) | |
# W1 is a 4x4 matrix | |
$W1 = @( | |
@(0.2, -0.5, 0.1, 2.0), # Weights for Hidden Neuron 1 | |
@(1.5, 1.3, -1.2, 0.7), # Weights for Hidden Neuron 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
$cert = $(Get--ChildItem Cert:\LocalMachine\My\1231231231231231231231231231231231231231), | |
$baseUrl = "https://<adfs.server>/adfs/services/trust" | |
) | |
function Get-Base64UrlDecode { | |
param([string[]]$InputString,[switch]$AsByteArray) | |
process { | |
$InputString | ForEach-Object { | |
$s = $_.Replace('-', '+').Replace('_', '/') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Orginal Cert | |
$base64CertAsGetContentImported = @( | |
'-----BEGIN CERTIFICATE-----' | |
'MIIDPjCCAiagAwIBAgIQQuZ95xvR1p5DHeDuOzxbPzANBgkqhkiG9w0BAQsFADAb' | |
'MRkwFwYDVQQDDBB3d3cuZmFicmlrYW0uY29tMB4XDTIxMDUyNTA3MzAwNFoXDTIy' | |
'MDUyNTA3NTAwNFowGzEZMBcGA1UEAwwQd3d3LmZhYnJpa2FtLmNvbTCCASIwDQYJ' | |
'KoZIhvcNAQEBBQADggEPADCCAQoCggEBANs51YbaCyGdgduRTKAwqd2R9z0BwfH1' | |
'RuBzWP4imFNjvgmJDR4tII3ESng3udp3QqBu8ArdBVAZL0a5w+lJ9uhC8vD+pDGb' | |
'dtEqBi5fSzEMSGahVT+P8VqB2myVah9Ab6kuz5dGjtkIX7aoI3yId3Ji3lU8gtbv' | |
'U8Az5mxqhsDajl9BuUJCtVr02+i4WmbSLI3nzxFDXYJjJIVvrS/yxTzH7nuRud+d' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tmpFile = New-TemporaryFile | |
@" | |
DisplayName,Phone | |
Johan Akerstrom,0721234567 | |
Test Tester,0711234567 | |
"@ | Set-Content $tmpFile | |
#requires -version 5.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# How to get help right for an array of PSTypeNames | |
# | |
# Awesome function to get some random stuff | |
# The important thing is that we get objects with an added PSTypeName of 'Stuff' | |
Function Get-Stuff { | |
[cmdletbinding()] | |
param( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$definition = @' | |
using System; | |
using System.Runtime.InteropServices; | |
public class W32ShutdownUtil { | |
[DllImport("advapi32.dll", SetLastError = true)] | |
public static extern bool AbortSystemShutdown(String machineName); | |
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] | |
internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
While ( $True ) { $PSise.Options.Zoom = 100 + 10 * [math]::sin( (Get-Date).TimeOfDay.TotalSeconds ); Sleep -Milliseconds 40 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-ADGroupMemberSamAccountName { | |
param( | |
[Parameter(Mandatory,ValueFromPipeline)] | |
[ValidateNotNullOrEmpty()] | |
[string]$GroupName | |
) | |
process { | |
$name = $GroupName | |
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() | |
$dc = $domain.FindDomainController([System.DirectoryServices.ActiveDirectory.LocatorOptions]::WriteableRequired) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Name = "MSFT-Office 365 Enterprise E1" | |
$groupSearcher = [adsisearcher]"(samaccountname=$Name)" | |
$group = $groupSearcher.FindOne() | |
$memberSearch = [adsisearcher]::new($group.GetDirectoryEntry(),"(&(objectClass=user)(objectCategory=Person))",[string[]]'samaccountname','base') | |
$memberSearch.AttributeScopeQuery = "member"; | |
foreach($member in $memberSearch.FindAll()) | |
{ | |
$member.Properties['samaccountname'] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DropDown Data | |
$office = @{ | |
'HQ' = 'Ground floor','1st floor','2nd floor','3rd floor' | |
'Garage' = 'Shop floor','Office' | |
'Sales office' = 'Ground floor','1st floor' | |
} | |
# Load assemblies | |
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | |
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") |
NewerOlder