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
$startDate = (Get-Date).ToString('Mddyy') # 51515 | |
$ca=$startDate.ToCharArray() | |
[array]::Reverse($ca) | |
$ofs='' | |
$startDate -eq "$ca" # prints True |
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 cal { | |
param( | |
[string[]]$TargetMonth=(Get-Date).ToString('MMM'), | |
$Year=(Get-Date).year | |
) | |
foreach ($month in $TargetMonth) { | |
$q = "$month $year calendar" |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
Configuration DotNetFrameWork{ | |
param($TargetMachine) | |
Node $TargetMachine { | |
WindowsFeature NET-Framework-Features { | |
Ensure = 'Present' | |
Name = "NET-Framework-Features" | |
} | |
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 GenerateDSC { | |
$WindowsFeature = Get-WindowsFeature | Where {$PSItem.installed -and $PSItem.name -match 'net-framework'} | % { | |
@" | |
WindowsFeature $($PSItem.name) { | |
Ensure = 'Present' | |
Name = "$($PSItem.name)" | |
} |
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 DateUtils { | |
static [datetime] EasterSunday($year) { | |
$a = $year % 19 | |
$b = [math]::Truncate($year/100) | |
$c = $year % 100 | |
$d = [math]::Truncate($b/4) | |
$e = $b%4 | |
$f = [math]::Truncate(($b+8)/25) | |
$g = [math]::Truncate(($b-$f+1)/3) | |
$h = ((19*$a)+$b-$d-$g+15)%30 |
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 MoonRiseLCT(DY As Double, MN As Double, YR As Double, DS As Double, ZC As Double, GLong As Double, GLat As Double) As Double | |
Dim K As Integer | |
GDY = LctGDay(12, 0, 0, DS, ZC, DY, MN, YR) | |
GMN = LctGMonth(12, 0, 0, DS, ZC, DY, MN, YR) | |
GYR = LctGYear(12, 0, 0, DS, ZC, DY, MN, YR) | |
LCT = 12#: DY1 = DY: MN1 = MN: YR1 = YR | |
GoSub 6700: LA = LU | |
For K = 1 To 8 |
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
ipmo wpk | |
function Get-Color{ | |
[Windows.Media.Brushes] | | |
Get-Member -Static -MemberType Property | | |
ForEach { [Windows.Media.Brushes]::$($_.Name) } | |
} | |
function Get-Brightness { | |
param ( |
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 Export-VBAToHashTable { | |
param($fileName) | |
$inFunction=$false | |
$h=@{} | |
switch -regex (Get-Content $fileName) { | |
"^function" { | |
$inFunction=$true |
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
## | |
## Thanks to Jum Truher on the PowerShell team https://jtruher3.wordpress.com/ | |
## | |
$scriptRoot = Split-Path $MyInvocation.MyCommand.Path | |
. "$scriptRoot\RubyArraylistConstructs.ps1" | |
Describe "Ruby array constructs are available on an ArrayList" { | |
BeforeEach { |