Skip to content

Instantly share code, notes, and snippets.

Mathias R. Jessen IISResetMe

  • Netherlands
Block or report user

Report or block IISResetMe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Get-WebExceptionBody.ps1
function Get-WebExceptionBody
if(-not $PSBoundParameters.ContainsKey('Last')){
$Last = 1
View Test-WebRequest.class.ps1
using namespace System
using namespace System.Net
using namespace System.Text
using namespace System.IO
class Test
# Specify the URL to receive the request.
static Run([string[]]$arguments)
IISResetMe / gist:e0c20ce4fdbab7e19a75255e9d4787d1
Created Nov 26, 2019
Signing XML documents with PowerShell
View gist:e0c20ce4fdbab7e19a75255e9d4787d1
Add-Type -AssemblyName System.Security
function Sign-XML {
Param ( [xml]$xml, [System.Security.Cryptography.X509Certificates.X509Certificate2]$certificate )
[System.Security.Cryptography.xml.SignedXml]$signedXml = $NULL
$signedXml = New-Object System.Security.Cryptography.Xml.SignedXml -ArgumentList $xml
$signedXml.SigningKey = $certificate.PrivateKey
$keyInfo = New-Object System.Security.Cryptography.Xml.KeyInfo
View CustomSortedDictionary.ps1
using namespace System.Collections.Generic
# First we define our comparer
class SortPropertyFirstComparer : IComparer[string]
if($a -ceq 'Property'){
return -1
View MeasureStringAdd.ps1
# download and install
Import-Module MeasureScript
Measure-Script -ScriptBlock {# use a stopwatch to measure performance
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
# create a StringBuilder
$text = ""
# appending a string often
View not_so_speedy_string_concat.ps1
Add-Type @'
public struct StringWrapper
string s;
public StringWrapper(string s){ this.s = s; }
public void Add(string suffix)
s += suffix;
IISResetMe / OleReader.cs
Created Nov 8, 2019
Naive OLE file header parser based on inline AAF spec comments from olefile
View OleReader.cs
using System;
using System.IO;
using System.Runtime.InteropServices;
public class OleReader
public OleReader(string filename, long offset = 0L)
if (string.IsNullOrWhiteSpace(filename))
View MergeObjectCommand.cs
using System;
using System.Collections.Generic;
using System.Management.Automation;
namespace MyCmdlets
[Cmdlet(VerbsData.Merge, "Object")]
public class MergeObjectCommand : PSCmdlet
[Parameter(ValueFromPipeline = true, Mandatory = true)]
View Update-ADPassword.ps1
function Update-ADPassword
[string]$Domain = $env:USERDOMAIN
try {
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$ctx = [System.DirectoryServices.AccountManagement.PrincipalContext]::new('Domain', $Domain)
$acc = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($ctx, ($currCred = Get-Credential -Message 'Input your current credentials').UserName)
View Test-PSCache.ps1
Import-Module PSCache
# Define fetcher
$Fetcher = {
# Emulate a potentially slow operation
Start-Sleep -Milliseconds (Get-Random -Minimum 15 -Maximum 30)
# Return an object corresponding to $_
ID = $_
You can’t perform that action at this time.