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 Ping-Forever.ps1
# Ping-Forever.ps1
# Modified version of alexinnes/ConstantPingToServer.ps1 (
[string]$LogDirectory = 'C:\ping logs\'
IISResetMe / simplefilterparser.ps1
Created Aug 4, 2015
Very frail PowerShell string-filter parser
View simplefilterparser.ps1
function Parse-SimpleFilter {
$err = @() # TODO inspect parsing errors
$Tokens = [System.Management.Automation.PSParser]::Tokenize($Filter,[ref]$err)
$Elements = foreach($t in $Tokens){
([System.Management.Automation.PSTokenType]::Command) {
'$_.{0}' -f $t.Content
IISResetMe / nullcoalesce.ps1
Last active Aug 29, 2015
C#-style Null Coalesce (??) operator
View nullcoalesce.ps1
function ?? {
$args |Select-Object -First 1
# Use like:
# $Name = ?? (Get-ADUser $_ | Select-Object -Expand Name) "John Doe"
# supports as many fallthroughs as you like (like chained ?? in C#)
# $Something ?? $null $null $null 1
# ($Something -eq 1) is now the case
View Measure-Lines.ps1
function Measure-Lines {
param($Path = 'C:\log.txt')
$FileStream = New-Object IO.FileStream ($Path,[System.IO.FileMode]::Open,[System.IO.FileAccess]::Read,[System.IO.FileShare]::ReadWrite)
$StreamReader = New-Object System.IO.StreamReader $FileStream
$TotalLines = 0
while($StreamReader.ReadLine() -ne $null){
IISResetMe / SGSept2015.ps1
Last active Sep 5, 2015
2015 Scripting Games - September puzzle
View SGSept2015.ps1
# Most straighforward way I can think of
# 2 pairs of curly braces and a single semicolon for the calculated OSVERSION property
Import-Csv .\input.csv |Select-Object -Property MACHINENAME,@{Label='OSVERSION';Expression={(Get-WmiObject Win32_OperatingSystem -ComputerName $_.MACHINENAME).Caption}} | Export-Csv .\output.csv -NoTypeInformation
IISResetMe / objects.ps1
Created Sep 16, 2015
Offline comments for Richard Siddaway's Objective: Objects talk @ PSHSummit
View objects.ps1
#region new()
# new() works not only on PS Classes, but wraps existing .NET ctors as well:
#region Add-Type
#region Access modifiers
IISResetMe / Split-VMName.ps1
Created Nov 12, 2015
2015 Scripting games puzzle, November
View Split-VMName.ps1
# Trim whitepsace on input string,
# then split at commas (surrounded by 0 or more whitespace chars on each side)
$VMNameStr.Trim() -split "\s*,\s*"
IISResetMe / escapewildcard.ps1
Created Nov 15, 2015
Manually escape wildcards
View escapewildcard.ps1
gci Test*|select @{Name="Path";Expression={[regex]::Replace($_.FullName,"\[|\]|\*|\?",{'`{0}'-f$args[0]})}}|gci -Recurse
IISResetMe / eDellRoot.ps1
Created Nov 23, 2015
Do you trust eDellRoot? Find out with this one-liner!
View eDellRoot.ps1
if((New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 (,[byte[]]@(45,45,45,45,45,66,69,71,73,78,32,67,69,82,84,73,70,73,67,65,84,69,45,45,45,45,45,10,77,73,73,67,56,122,67,67,65,100,43,103,65,119,73,66,65,103,73,81,97,56,86,55,108,82,105,84,113,112,100,76,89,107,114,65,105,80,119,55,116,106,65,74,66,103,85,114,68,103,77,67,72,81,85,65,77,66,81,120,69,106,65,81,10,66,103,78,86,66,65,77,84,67,87,86,69,90,87,120,115,85,109,57,118,100,68,65,101,70,119,48,120,78,84,65,48,77,68,99,120,77,68,73,122,77,106,100,97,70,119,48,122,79,84,69,121,77,122,69,121,77,122,85,53,78,84,108,97,10,77,66,81,120,69,106,65,81,66,103,78,86,66,65,77,84,67,87,86,69,90,87,120,115,85,109,57,118,100,68,67,67,65,83,73,119,68,81,89,74,75,111,90,73,104,118,99,78,65,81,69,66,66,81,65,68,103,103,69,80,65,68,67,67,10,65,81,111,67,103,103,69,66,65,76,51,82,74,103,49,117,122,86,117,69,88,48,72,119,52,88,87,71,122,115,54,111,73,57,87,43,111,55,72,90,100,86,100,66,77,77,86,98,52,71,122,98,52,117,90,106,67,84,78,106,98,80,120,52
IISResetMe / Get-AST.ps1
Created Dec 1, 2015
PowerShell can parse itself just fine
View Get-AST.ps1
function Get-AST
foreach($Script in $InputObject){
$Tokens = $Errors = @()
You can’t perform that action at this time.