Skip to content

Instantly share code, notes, and snippets.

@Cirzen
Cirzen / WordleAnalysis.ps1
Last active January 17, 2022 19:31
Run analysis on your Wordle game post completion to see how you performed compared to a (possible) optimal strategy
using namespace System.Collections.Generic;
$sortedWords = @("aback", "abase", "abate", "abbey", "abbot", "abhor", "abide", "abled", "abode", "abort", "about", "above", "abuse", "abyss", "acorn", "acrid", "actor", "acute", "adage", "adapt", "adept", "admin", "admit", "adobe", "adopt", "adore", "adorn", "adult", "affix", "afire", "afoot", "afoul", "after", "again", "agape", "agate", "agent", "agile", "aging", "aglow", "agony", "agora", "agree", "ahead", "aider", "aisle", "alarm", "album", "alert", "algae", "alibi", "alien", "align", "alike", "alive", "allay", "alley", "allot", "allow", "alloy", "aloft", "alone", "along", "aloof", "aloud", "alpha", "altar", "alter", "amass", "amaze", "amber", "amble", "amend", "amiss", "amity", "among", "ample", "amply", "amuse", "angel", "anger", "angle", "angry", "angst", "anime", "ankle", "annex", "annoy", "annul", "anode", "antic", "anvil", "aorta", "apart", "aphid", "aping", "apnea", "apple", "apply", "apron", "aptly", "arbor", "ardor", "arena", "argue", "arise", "armor",
function Get-DeviceLocation
{
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[TimeSpan]
$TimeOut = [timespan]::FromSeconds(5),
# The accuracy of the reported location. Default relies on Network location (but can still be quite accurate). "High" requires GPS or similar to produce results
[Parameter(Mandatory = $false)]
@Cirzen
Cirzen / InterfaceTree.psm1
Last active March 18, 2019 12:09
Get InterfaceTree module
function Get-InterfaceTree
{
<#
.SYNOPSIS
Displays a tree of interfaces for a given type
.DESCRIPTION
Recursively runs the "GetInterfaces() method on a type and its interfaces to build a picture of all the interfaces that are applied to a type"
.EXAMPLE
PS C:\> Get-InterfaceTree hashtable
# Add required types for below functions
Add-Type -AssemblyName System.Web | Out-Null
Try
{
# Define [RequiredChars] enum type
Add-Type -Language CSharp -TypeDefinition @"
[System.Flags]
public enum RequiredChars
<#
.Synopsis
Gets NTBiosName for a given domain
.DESCRIPTION
Uses .Net framework and COM objects only. No reliance on AD Cmdlets
Adapted from 'http://rlmueller.net/NameTranslateFAQ.htm#Powershell%20example' by Richard L. Mueller
Adapted by David Johnson https://gist.github.com/Cirzen
.PARAMETER Domain
Text string to use as the search criterion
.PARAMETER Credential
@Cirzen
Cirzen / Function_Get-SysCorpInfo.ps1
Created September 11, 2015 22:36
My attempt at the July 2015 Verified Effective practice question
<#
.Synopsis
Get simple Bios and OS info
.DESCRIPTION
Queries Win32_BIOS and Win32_Operating system over WsMan (default) or DCom protols to obtain Bios Serial, Service Pack Version and OSVersion info
.EXAMPLE
PS> Get-CorpSysInfo -ComputerName win81 -Protocol dcom
BIOSSerial ComputerName SPVersion OSVersion
@Cirzen
Cirzen / Wordinian.ps1
Created August 11, 2015 08:36
Wordinian word search.
#Find Wordinian words. See www.wordinian.com
#E.g. Stage: Stag, age, ta, a
$wordlist = Get-Content C:\Users\DJ\Downloads\TWL06.txt #Downloaded scrabble dictionary
$Searchwordlength = 12
Function Test-Word ($word, $wordlist) {
Return $wordlist -match $word -as [bool]
}
@Cirzen
Cirzen / gist:4364d59742fba9b5ce5c
Last active August 29, 2015 14:25
SumProduct, Exponential arrays and weighted averages
Function Get-ArrayProduct {
<#
.SYNOPSIS
Returns the multiplication product of two equally sized numerical arrays.
e.g (1,2,3) * (4,5,6) causes (1*4,2*5,3*6) and returns (4,10,18)
#>
[CmdLetBinding()]
Param(