Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
@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 (
@dfinke
dfinke / InvokeCompileAllTS.ps1
Created October 20, 2012 13:40
Recursively searches for TypeScript files and invokes the compiler on the target
function Invoke-CompileAllTS {
<#
.Synopsis
Recursively searches for TypeScript files and invokes the compiler on the target
.Example
Invoke-CompileAllTS
#>
ls . -Recurse *.ts | ForEach {tsc $_.fullname}
}
@dfinke
dfinke / gist:3974322
Created October 29, 2012 15:52
Works in a console app not a windows store app
var name = "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
var asmName = new System.Reflection.AssemblyName(name);
var asm = System.Reflection.Assembly.Load(asmName);
@dfinke
dfinke / gist:4011813
Created November 4, 2012 12:59
Test Timings of multiplication
# Which do you think takes less time to multiply the #'s 1 to 55?
function Test-Timings {
param(
$iterations=5,
$type,
$sb
)
1..$iterations | ForEach {
@dfinke
dfinke / GetAcquistion.ps1
Created November 18, 2012 21:04
PowerShell Crunchbase function to get acquisitions by company
# http://developer.crunchbase.com/page
function Get-Acquisition {
param(
[Parameter(ValueFromPipeLine)]
$company = "facebook"
)
Process {
$url = "http://api.crunchbase.com/v/1/company/$($company).js"
@dfinke
dfinke / ppm.ps1
Created November 28, 2012 14:00
Potential analogy to npm and package.json
param ($key)
<#
# sample package.ps1
@{
start = {1..10}
stuff = "this is stuff"
}
#>
@dfinke
dfinke / InvokeNodeJS
Created December 25, 2012 20:53
Invokes PowerShell from node
function Invoke-NodeJS {
param(
$PowerShellCommand,
[Switch]$ReturnAsJSON
)
if($ReturnAsJSON) {$PowerShellCommand += " | ConvertTo-Json"}
$tmp = [IO.Path]::GetTempFileName()
@dfinke
dfinke / GetFreePDFs.ps1
Last active July 15, 2024 22:31
Uses PowerShell v3 to find the free chapters of "PowerShell in Depth" and downloads the PDF
$url="http://www.manning.com/jones2/"
(Invoke-WebRequest $url).links | where onclick -match 'free' | foreach {
[PSCustomObject] @{
innerHTML = $_.innerHTML
FullHref = $url+$_.href
href = $_.href
url = $url
}
} | ForEach {
# http://p0w3rsh3ll.wordpress.com/2013/01/11/searching-microsoft-security-bulletins/
$MSBulletins = New-WebServiceProxy -Uri 'http://technet.microsoft.com/sto/services/BulletinSearch.asmx'
#int productId,
#bool mostRecent,
#string startDate,
#string endDate,
#Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1o_services_BulletinSearch_asmx.SortField sortField,
#Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1o_services_BulletinSearch_asmx.SortOrder sortOrder,
pushd
md OWIN | out-null
cd OWIN
npm install express
npm install owin
Add-Type -OutputAssembly OwinHelloWorld.dll -TypeDefinition @"