Skip to content

Instantly share code, notes, and snippets.

View rorymacleod's full-sized avatar

Rory MacLeod rorymacleod

View GitHub Profile
SET NOCOUNT ON;
SET XACT_ABORT ON;
DECLARE @ItemList TABLE (
Num INT PRIMARY KEY IDENTITY (1, 1),
ItemId INT
)
INSERT INTO @ItemList (ItemId)
SELECT Id
Update-ExecutionPolicy
Set-WindowsExplorerOptions -EnableShowFileExtension -EnableShowFullPathInTitleBar -EnableExpandToOpenFolder -EnableShowRibbon
Set-TaskbarOptions -Size Large -Combine Never
cinst googlechrome
cinst notepad2
cinst 7zip
cinst setpoint
cinst git
cinst git-credential-winstore
@rorymacleod
rorymacleod / new-chocolate.txt
Created May 26, 2017 21:43
Chocolatey commands for setting up a Dev PC
chrome
lastpass chrome
cinst notepad2
cinst dropbox
cinst git-credential-winstore
cinst gitextensions
google drive
@rorymacleod
rorymacleod / Fiddler-CORS-rules.js
Last active August 29, 2015 14:17
Spoof a CORS response from the Cyan Web API server, allowing an app to run in a browser. In this case, the server was already returning the OPTIONS response correctly.
static function OnBeforeResponse(oSession: Session) {
// ...
// Spoofs the Cyan Web API CORS headers, allowing apps to run in a browser.
if (oSession.HostnameIs("api-dev.cyan.us.com") && oSession.oResponse) {
if (!oSession.HTTPMethodIs("OPTIONS")) {
oSession.oResponse.headers.Add("Access-Control-Allow-Origin", oSession.oRequest.headers["Origin"]);
oSession.oResponse.headers.Add("Access-Control-Allow-Credentials", "true");
oSession.oResponse.headers.Add("Access-Control-Allow-Headers", "Authorization, X-Api-Version, X-Cyan-TenantAccessKey, Content-Type");
oSession.oResponse.headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
@rorymacleod
rorymacleod / TestSynchronizationContext.cs
Last active December 10, 2015 14:08
A derived SynchronizationContext for use in unit tests. There's no easy way to truly post a callback onto the same thread that's running the test, as if it was the UI thread, but this code at least allows the callback to identify the SynchronizationContext it was posted to.
/// <summary>
/// Provides a synchronization context for unit tests.
/// </summary>
public sealed class TestSynchronizationContext: SynchronizationContext
{
/// <summary>
/// A reference to the <c>TestSynchronizationContext</c> that has posted or sent a delegate to the current
/// thread.
/// </summary>
[ThreadStatic]
@rorymacleod
rorymacleod / ConvertTfsToGit.ps1
Created March 7, 2011 21:31
Powershell script to convert TFS changesets into git commits.
$path = $env:userprofile + "\Code\TFS_Project"
Set-Location $path
$ErrorActionPreference = "Stop"
$tf = [System.IO.Path]::GetFullPath($env:vs100comntools + "..\IDE\TF.exe")
$tfpt = "${env:programfiles(x86)}\Microsoft Team Foundation Server 2010 Power Tools\TFPT.exe"
$history = & $tf history . /noprompt /format:brief /recursive
$history = $history[2..($history.Length - 1)]
"Converting {0} changesets..." -f $history.Length