Skip to content

Instantly share code, notes, and snippets.

View cdhunt's full-sized avatar

Chris Hunt cdhunt

View GitHub Profile
@cdhunt
cdhunt / powerlambda
Last active August 29, 2015 13:57
Trying to create a variable containing a lambda expression
# Trying to call ListByNameFiltered from
# http://www.orthogonal.com.au/computers/simpledb/index.htm
# (input parameters) => expression
# (id) => { return id == 1234; }
[System.Reflection.Assembly]::LoadWithPartialName("System.Linq.Expressions")
if ( [string]::IsNullOrEmpty([psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::get["Expression"]) )
{
@cdhunt
cdhunt / WatiNonPSate.ps1
Created March 27, 2014 15:07
Running automated browser tests with WatiN and PSate.
Add-Type -Path C:\WatiN\bin\net40\WatiN.Core.dll
if ( [string]::IsNullOrEmpty([psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::get["Find"]) )
{
[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::add("Find", "WatiN.Core.Find")
}
Describing 'Bing Search' {
Given 'Search for "Automated Ops"' {
@cdhunt
cdhunt / PoshImageProcessor
Created May 22, 2014 19:11
Posh Wrapper for the .Net ImageProcessor library
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
@cdhunt
cdhunt / PerfmonCountersDrive
Last active August 29, 2015 14:04
Perfmon Counter Provider
root {
Get-Counter -ListSet * | Select-Object -ExpandProperty CounterSetName | foreach-object {
$content = $_;
script $content {
Get-Counter -ListSet $content
}.GetNewClosure();
}
}
function Register-HistoryInfoCustomType
{
Update-TypeData -TypeName Microsoft.PowerShell.Commands.HistoryInfo `
-MemberType ScriptProperty `
-MemberName TotalExecutionTime `
-value { $this.EndExecutionTime - $this.StartExecutionTime} `
-Force
}
Verifying that +cdhunt is my blockchain ID. https://onename.com/cdhunt
# https://bitbucket.org/gfkeogh/simpledb/wiki/Home
Add-Type -Path C:\Scripts\Modules\SimpleDb\SimpleDb.Esent.dll
# Data Model
$episodeClass = @"
using System;
public class Episode
{
public string Series { get; set; }
public int Id { get; set; }
function New-Array {,$args}
PS C:\> Start-PSNode -Server http://localhost:9092/ -AuthenticationType IntegratedWindowsAuthentication -Command {
Get-Process | Select-Object Handle, WorkingSet, Id, Name, UserProcessorTime | ConvertTo-Json
}
PS C:\> Get-Web "http://localhost:9092" -AsJson