Skip to content

Instantly share code, notes, and snippets.

View EtherZa's full-sized avatar

Richard Pringle EtherZa

  • Perth, Australia
View GitHub Profile
/*
This script helps simulate deadlocks. Run the entire script in a SQL query window. It will continue running until stopped.
In the target script, insert a call to sp_simulatedeadlock where you want the deadlock to occur.
This stored procedure, also created below, causes the deadlock.
When you are done, stop the execution of this window and run the code in the cleanup section at the bottom.
*/
SET NOCOUNT ON
IF OBJECT_ID('DeadlockTest') IS NOT NULL
DROP TABLE DeadlockTest
@EtherZa
EtherZa / generate.ps1
Created May 12, 2017 10:27
Generate WCF service from WSDL (URL hosted) and rewrite fields as properties
$url = "http://<url>?WSDL"
$name = "<Service Name>"
$namespace = "<Base Namespace>." + $name
$file = "$name.generated.cs"
echo "Generating service $name ($url)"
& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\SvcUtil.exe" /t:code $url /language:C# /n:"*,$namespace" /out:$file /noConfig /syncOnly | out-null
(Get-Content $file) | Foreach-Object {$_ -replace "(?<=public [\w\.]+(?:\[\])? \w+)(;)", " { get; set; }"} | Set-Content $file