Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Hunt cdhunt

View GitHub Profile
@cdhunt
cdhunt / powerlambda
Last active Aug 29, 2015
Trying to create a variable containing a lambda expression
View powerlambda
# 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 Mar 27, 2014
Running automated browser tests with WatiN and PSate.
View WatiNonPSate.ps1
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
Posh Wrapper for the .Net ImageProcessor library
View PoshImageProcessor
<#
.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 Aug 29, 2015
Perfmon Counter Provider
View PerfmonCountersDrive
root {
Get-Counter -ListSet * | Select-Object -ExpandProperty CounterSetName | foreach-object {
$content = $_;
script $content {
Get-Counter -ListSet $content
}.GetNewClosure();
}
}
View Register-HistoryInfoCustomType
function Register-HistoryInfoCustomType
{
Update-TypeData -TypeName Microsoft.PowerShell.Commands.HistoryInfo `
-MemberType ScriptProperty `
-MemberName TotalExecutionTime `
-value { $this.EndExecutionTime - $this.StartExecutionTime} `
-Force
}
View blockchain id
Verifying that +cdhunt is my blockchain ID. https://onename.com/cdhunt
View tvdbapiconsumer
# 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; }
View Start-PSNodeExample.ps1
PS C:\> Start-PSNode -Server http://localhost:9092/ -AuthenticationType IntegratedWindowsAuthentication -Command {
Get-Process | Select-Object Handle, WorkingSet, Id, Name, UserProcessorTime | ConvertTo-Json
}
View Get-WebExample.ps1
PS C:\> Get-Web "http://localhost:9092" -AsJson
You can’t perform that action at this time.