Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
$startDate = (Get-Date).ToString('Mddyy') # 51515
$ca=$startDate.ToCharArray()
[array]::Reverse($ca)
$ofs=''
$startDate -eq "$ca" # prints True
@dfinke
dfinke / cal.ps1
Created May 19, 2015 00:15
PowerShell WolframAlpha Calendar Cmdlet
function cal {
param(
[string[]]$TargetMonth=(Get-Date).ToString('MMM'),
$Year=(Get-Date).year
)
foreach ($month in $TargetMonth) {
$q = "$month $year calendar"
@dfinke
dfinke / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Configuration DotNetFrameWork{
param($TargetMachine)
Node $TargetMachine {
WindowsFeature NET-Framework-Features {
Ensure = 'Present'
Name = "NET-Framework-Features"
}
Function GenerateDSC {
$WindowsFeature = Get-WindowsFeature | Where {$PSItem.installed -and $PSItem.name -match 'net-framework'} | % {
@"
WindowsFeature $($PSItem.name) {
Ensure = 'Present'
Name = "$($PSItem.name)"
}
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
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
@dfinke
dfinke / New-PieChart.ps1
Created May 28, 2011 23:37 — forked from danielmoore/New-PieChart.ps1
Creates a new pie chart using WPK
ipmo wpk
function Get-Color{
[Windows.Media.Brushes] |
Get-Member -Static -MemberType Property |
ForEach { [Windows.Media.Brushes]::$($_.Name) }
}
function Get-Brightness {
param (
function Export-VBAToHashTable {
param($fileName)
$inFunction=$false
$h=@{}
switch -regex (Get-Content $fileName) {
"^function" {
$inFunction=$true
##
## 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 {