This file contains 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 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 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 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 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 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 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 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 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 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 | | |
OlderNewer