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
$template = @' | |
{[DateTime]Date*:Tue Nov 11, 2014} {Home:Penguins}{Away:Rangers} {[DateTime]Time:7:00 PM} FINAL PIT (0) - NYR (5) Recap | |
{Date*:Sat Mar 14, 2015} {Home:Bruins}{Away:Penguins} 1:00 PM ROOT, NHLN-US, TVA Tickets BUY/SELL | |
Thu Mar 26, 2015 PenguinsHurricanes 7:00 PM ROOT | |
Sat Nov 22, 2014 PenguinsIslanders 7:00 PM ROOT, CITY | |
Sat Nov 1, 2014 SabresPenguins 7:00 PM FINAL BUF (0) - PIT (5) Recap | |
Fri Jan 16, 2015 PenguinsIslanders 7:00 PM ROOT, TVA2 | |
'@ | |
(Invoke-WebRequest http://penguins.nhl.com/club/schedule.htm).AllElements | |
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
class GeometryNumber { | |
[double]$Number | |
GeometryNumber() {} | |
GeometryNumber($Number) { $this.Number=$Number } | |
[GeometryNumber] Sqrt() { return [GeometryNumber]::new([Math]::Sqrt($this.Number)) } | |
[GeometryNumber] Reciprocal() { return [GeometryNumber]::new(1/$this.Number) } | |
[GeometryNumber] TangetAngle() { return [GeometryNumber]::new([System.Math]::Atan($this.Number)) } | |
[GeometryNumber] AsDegrees() { return [GeometryNumber]::new($this.Number*180/[Math]::PI) } |
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 mynetstat { | |
$t=@" | |
Proto Local Address Foreign Address State | |
{Proto*:TCP} {Address:0.0.0.0:80} {FA:my-laptop:0} {State:LISTENING} | |
TCP 0.0.0.0:135 my-laptop:0 LISTENING | |
TCP 192.168.0.6:139 my-laptop:0 LISTENING | |
{Proto*:TCP} 192.168.0.6:1128 a23-209-83-52:https {State:CLOSE_WAIT} | |
"@ | |
$data | cfs -TemplateContent $t | select * -ExcludeProperty ExtentText |
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
1..10 | ForEach { | |
$r = 0..($_-1) -join '' | |
$exp = "$($r)*9+$_" | |
"{0,15}={1}" -f $exp, ($exp|Invoke-Expression) | |
} | |
'' |
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
param($Rows=8, $Columns=8) | |
Add-Type -AssemblyName System.Drawing | |
class Cell { | |
[int]$Row | |
[int]$Col | |
$links = @{} |
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 ConvertFrom-JsonToCsv { | |
param( | |
[Parameter(ValueFromPipeline)] | |
$json | |
) | |
Process { | |
($json | ConvertFrom-Json) | ConvertTo-Csv -NoTypeInformation | |
} | |
} |
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-DateOfEaster { | |
param( | |
[Parameter(ValueFromPipeline)] | |
$Year=(Get-Date).Year | |
) | |
Process { | |
[pscustomobject]@{} | | |
Add-Member -PassThru -MemberType NoteProperty C3 $Year | |
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 Expand-Alias { | |
$Editor=$psISE.CurrentFile.Editor | |
$script=$Editor.Text | |
[ref]$errors=$null | |
[System.Management.Automation.PsParser]::Tokenize($script, $errors) | | |
Where { $_.Type -eq 'Command'} | | |
Sort StartLine, StartColumn -Desc | | |
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
Add-Type -AssemblyName PresentationFrameWork | |
$MainWindow=@' | |
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Topmost="True" | |
WindowStartupLocation="CenterScreen" | |
Title="PowerSHell Summit Videos" Height="850" Width="1200"> | |
<Grid> | |
<Grid.RowDefinitions> |
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
$startDate = (Get-Date).ToString('Mddyy') # 51515 | |
$ca=$startDate.ToCharArray() | |
[array]::Reverse($ca) | |
$ofs='' | |
$startDate -eq "$ca" # prints True |