Skip to content

Instantly share code, notes, and snippets.

View RhysC's full-sized avatar

Rhys Campbell RhysC

  • Perth; Australia
View GitHub Profile
@RhysC
RhysC / PSAutoTest
Created October 18, 2010 18:33
Powershell with PSEventing and Nunit to watch my bin folder and auto run tests
if ( (Get-PSSnapin -Name pseventing -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin pseventing
}
Start-KeyHandler -CaptureCtrlC
$Script:initialdir = "C:\SG\SDP\Trunk\SDP\SDP"
$fsw = new-object system.io.filesystemwatcher
@RhysC
RhysC / Resharper cucumber Spec template
Created November 15, 2010 12:03
Resharper cucumber Spec template
Feature : $FeatureName$
In order $DesiredOutcome$
As a $Role$
I should $ActionThatDeliversBusinessBenefit$
Scenario: $ScenarioName$
Given $given$
When $when$
Then $then$
@RhysC
RhysC / cleanBin.ps1
Last active September 24, 2015 11:37
Powershell cleanBin (including azure folders)
function cleanBin {
param ([string]$path)
write-host "Cleaning bin from: $path"
get-childitem $path -include bin -recurse | remove-item -force -confirm:$false -recurse
write-host "Cleaning obj from: $path"
get-childitem $path -include obj -recurse | remove-item -force -confirm:$false -recurse
write-host "Cleaning csx from: $path"
@RhysC
RhysC / gist:742251
Created December 15, 2010 16:58
Dummy MSBuild "CheckIn Dance" File
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CheckinDance" ToolsVersion="3.5" >
<UsingTask TaskName="MSBuild.Community.Tasks.NUnit" AssemblyFile="..\Tools\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll" />
<PropertyGroup>
<SolutionFile>.\MySoln.sln</SolutionFile>
<UiTestSln>.\MySoln.UI.Tests.sln</UiTestSln>
<OutputPath Condition="'$(OutputPath)' == ''">.\Bin\</OutputPath>
<NUnitPath>..\Tools\NUnit-2.5.2\</NUnitPath>
<StatLightPath>..\Tools\StatLight\StatLight.exe</StatLightPath>
@RhysC
RhysC / gist:766183
Created January 5, 2011 11:06
PS Script that shows all txt lines in files that contain the given pattern (not recursive))
#Need to define $pattern
get-childitem . | get-childitem | select-string -pattern $pattern | foreach {$_.line}
@RhysC
RhysC / BasicLogmanDataCollection.bat
Created January 13, 2011 15:26
Performance monitoring with Logman - versioned CSV file tracking total prosessor time and available memory (Manually started)
# see http://msdn.microsoft.com/en-us/library/cc755366%28v=ws.10%29.aspx
md c:\perflogs\daily_log
#ensure logman has access to the newly created dir
Logman create counter daily_perf_log -v mmddhhmm -c "\Processor(_Total)\% Processor Time" "\Memory\Available bytes" -si 00:15 -o "c:\perflogs\daily_log" -f csv
Logman start daily_perf_log
#to stop collecting data
Logman stop daily_perf_log
@RhysC
RhysC / FxCopFilter.ps1
Created February 3, 2011 11:15
Filter and sort FXCop warning from build output - Powershell
$buildfile = "build.log"
$outputfile = "FxCopList.csv"
$hash = @{} # used to filter duplicates
$fxcopFilter = "[CodeAnalysis]"
gc $buildfile |
%{if($_.contains($fxcopFilter) -and $_.contains(" CA")) {$_}} |
%{
$startindex = $_.IndexOf($fxcopFilter) + $fxcopFilter.Length;
Get-ChildItem -exclude *.bak -Recurse -Include *.csproj |
Where-Object {$_.Attributes -ne "Directory"} |
ForEach-Object {
Copy-Item $_ "$($_).bak";
(Get-Content $_) -replace "<HintPath>..\\..\\Lib","<HintPath>..\\..\\..\\Lib" | Set-Content -path $_
}
@RhysC
RhysC / cleanSvn.ps1
Created February 23, 2011 16:12
Recursively the svn folders from a path
function cleanSvn {
param ([string]$path)
write-host "Cleaning svn from: $path"
get-childitem $path -include .svn -recurse -force | remove-item -force -confirm:$false -recurse
}
@RhysC
RhysC / ShowProjectReferencePaths.ps1
Created February 28, 2011 16:31
Shows all the hints paths for the projects in your solution TAGS : reference binary dependency
$pattern = "HintPath"
get-childitem . | get-childitem | select-string -pattern $pattern |
foreach { $_.line.Replace("<HintPath>", "").Replace("</HintPath>", "").Replace("..\\", "").Replace("..\", "").Trim() } |
sort | Get-Unique > files.txt