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
$CountryLookup = [ordered]@{ | |
"AD"="ANDORRA" | |
"AE"="UNITED ARAB EMIRATES" | |
"AF"="AFGHANISTAN" | |
"AG"="ANTIGUA AND BARBUDA" | |
"AI"="ANGUILLA" | |
"AL"="ALBANIA" | |
"AM"="ARMENIA" | |
"AO"="ANGOLA" | |
"AQ"="ANTARCTICA" |
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 Find-GuidUsage { | |
param( | |
[Parameter(Mandatory=$true)] | |
$path, | |
$filter="*.cs" | |
) | |
$GuidPattern = "({|\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\))?" | |
dir $path -Recurse $filter | |
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 ConvertTo-PigLatin { | |
param( | |
[Parameter(ValueFromPipeline)] | |
[string[]]$string | |
) | |
Process { | |
$r += $(foreach($s in $string) { | |
if(Write-Output b c d f g h j k l m n p q r s t v w x y z -eq $s[0]) { |
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 Invoke-Thesaurus { | |
param( | |
$Word='Thesaurus', | |
$FilterCategory | |
) | |
$language='en_US' | |
$key='<get key here http://thesaurus.altervista.org/mykey>' | |
$result="json" |
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-GithubEvent { | |
param($userId,$Password) | |
function Get-GitHubAuthHeaders { | |
param($userId,$Password) | |
$authInfo = "$($userId):$($Password)" | |
$authInfo = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($authInfo)) |
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
workflow Get-GithubEmojis { | |
param($TargetPath="c:\temp\emojis") | |
if(!(Test-Path -Path $TargetPath)) { | |
$null= New-Item -ItemType Directory -Path $TargetPath | |
} | |
$emojis = Invoke-RestMethod -Uri https://api.github.com/emojis |
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-TimeStamp { | |
param( | |
[Switch]$Yesterday, | |
[Switch]$ToClipboard | |
) | |
$date = Get-Date | |
if($Yesterday) { | |
$date = $date.AddDays(-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
function Edit-NewIseFile { | |
param( | |
[Parameter(ValueFromPipeline=$true)] | |
$Filename, | |
[Switch]$AddFunction | |
) | |
Process { | |
$content="" |
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
#Requires -Version 5.0.9814.0 | |
if(!($PSVersionTable.PSVersion.Major -ge 5 -and $PSVersionTable.PSVersion.Build -ge 9814)) { | |
"Sorry you need PSVersion 5.0.9814.0 or newer" | |
$psversiontable | |
return | |
} | |
Add-Type -AssemblyName presentationframework |
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
$email = '[email protected]' | |
$targetDate = (Get-Date).AddDays(-1).ToString("d") # yesterday | |
if(Get-Process outlook -ErrorAction Ignore) { | |
return "Please stop Outlook and re-run" | |
} | |
Write-Progress -Activity "Outlook" -Status "Connecting" | |
if($script:outlook -eq $null) { $script:outlook = new-object -com outlook.application } |