Skip to content

Instantly share code, notes, and snippets.

View PlagueHO's full-sized avatar
😼
Working on Game Master Copilot using Semantic Kernel, Azure OpenAI and Blazor 8

Daniel Scott-Raynsford PlagueHO

😼
Working on Game Master Copilot using Semantic Kernel, Azure OpenAI and Blazor 8
View GitHub Profile
@PlagueHO
PlagueHO / Example_DSCIntegrationTestsStep2.ps1
Created January 25, 2016 00:59
Example DSC Resource Integration Tests Step 2
It 'Should have set the resource and all the parameters should match' {
# Get the Rule details
$virtualDiskNew = Get-iSCSIVirtualDisk -Path $VirtualDisk.Path
$VirtualDisk.Path | Should Be $virtualDiskNew.Path
$VirtualDisk.DiskType | Should Be $virtualDiskNew.DiskType
$VirtualDisk.Size | Should Be $virtualDiskNew.Size
$VirtualDisk.Description | Should Be $virtualDiskNew.Description
}
@PlagueHO
PlagueHO / Example_DSCIntegrationTestsStep3.ps1
Created January 25, 2016 01:06
Example DSC Resource Integration Tests Step 3
# Clean up
Remove-iSCSIVirtualDisk `
-Path $VirtualDisk.Path
Remove-Item `
-Path $VirtualDisk.Path `
-Force
@PlagueHO
PlagueHO / New-TerminatingError.ps1
Created January 29, 2016 19:50
PowerShell code for throwing a custom terminating exception
$ErrorParam = @{
ErrorId = 'NICNotFound'
ErrorMessage = ($LocalizedData.NICNotFound -f $InterfaceAlias)
ErrorCategory = 'ObjectNotFound'
ErrorAction = 'Stop'
}
New-TerminatingError @ErrorParam
function New-TerminatingError
{
@PlagueHO
PlagueHO / CreateChocolateyPackage.cmd
Last active February 21, 2016 22:31
Create a new Chocolatey Package called MyApp.Portable
choco new devcon.portable
@PlagueHO
PlagueHO / devcon.portable.nuspec.xml
Created February 21, 2016 22:32
devcon.portable.nuspec
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>devcon.portable</id>
<title>DevCon (Portable)</title>
<version>1.0</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<summary>Device Console (DevCon) Tool (Portable)</summary>
@PlagueHO
PlagueHO / AppVeyor.yml
Created February 21, 2016 23:03
AppVeyor.yml for building a devcon.portable Chocolatey package
#---------------------------------#
# environment configuration #
#---------------------------------#
os: WMF 5
version: 10.0.10586.{build}
configuration: Release
platform: Any CPU
@PlagueHO
PlagueHO / AppVeyorDeployScript.ps1
Created February 21, 2016 23:19
The Deploy_Script component of the AppVeyor.yml for packaging the devcon.portable Chocolatey package.
Set-Location -Path .\devcon.portable\
(Get-Content '.\devcon.portable.nuspec' -Raw).Replace("<version>1.0</version>", "<version>$($env:APPVEYOR_BUILD_VERSION)</version>") | Out-File '.\devcon.portable.nuspec'
cpack
Push-AppveyorArtifact ".\devcon.portable.$($ENV:APPVEYOR_BUILD_VERSION).nupkg"
@PlagueHO
PlagueHO / Hashtable_Clone_Example.ps1
Created March 11, 2016 00:48
Clone a Hashtable PowerShell Example
$Car = [Hashtable]::New()
$Car.Add('Make','Lamborghini')
$Car.Add('Model','Aventador')
$NewCar = $Car.Clone()
@PlagueHO
PlagueHO / ICloneable_Class_PowerShell.ps1
Created March 11, 2016 01:12
Creating an ICloneable class in PowerShell, but without the Clone method being implemented.
class Car:ICloneable {
[String] $Make
[String] $Model
}
@PlagueHO
PlagueHO / ICloneable_Class_PowerShell_Finished.ps1
Created March 11, 2016 01:21
Creating an ICloneable class in PowerShell, with the Clone method implemented.
class Car:ICloneable {
[Object] Clone () {
$NewCar = [Car]::New()
foreach ($Property in ($this | Get-Member -MemberType Property))
{
$NewCar.$($Property.Name) = $this.$($Property.Name)
} # foreach
return $NewCar
} # Clone
[String] $Make