Skip to content

Instantly share code, notes, and snippets.

@brettveenstra
brettveenstra / transform.ps1
Created June 28, 2016 18:21 — forked from Warrenn/transform.ps1
Powershell script to transform a config file using a XML-Document-Transform file
function XmlDocTransform($xml, $xdt, $output)
{
if (!$xml -or !(Test-Path -path $xml -PathType Leaf)) {
throw "File not found. $xml";
}
if (!$xdt -or !(Test-Path -path $xdt -PathType Leaf)) {
throw "File not found. $xdt";
}
$transformDll = ""
@brettveenstra
brettveenstra / gource.sh
Created August 3, 2016 14:20 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@brettveenstra
brettveenstra / NancyOwinSelfHostWindowsAuth.cs
Created August 22, 2016 13:24 — forked from damianh/NancyOwinSelfHostWindowsAuth.cs
Nancy owin self hosting with Microsoft.Owin.HttpListener and windows authentication on .NET 4.0 (Personal opinion: avoid windows NTLM auth in web applications, even intranet ones. Use standards based SSO.)
namespace ConsoleApplication1
{
using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Principal;
using Microsoft.Owin.Hosting;
using Nancy;
using Owin;
@brettveenstra
brettveenstra / semver.ps1
Created September 13, 2016 19:26 — forked from mckn/semver.ps1
Semver stuff in powershell
function Bump-Version
{
param([string]$part = $(throw "Part is a required parameter."))
$version = Get-AssemblyInfoVersion -Directory ..\Source -GlobalAssemblyInfo $true
$bumpedVersion = Clone-Object -Object $version
switch -wildcard ($part)
{
"ma*" { $bumpedVersion.Major = Bump-NumericVersion -Current $version.Major }
@brettveenstra
brettveenstra / teamcity-metarunner-to-use-special-version-for-nuget.xml
Created November 29, 2016 13:42 — forked from augustoproiete/teamcity-metarunner-to-use-special-version-for-nuget.xml
Example of a TeamCity meta-runner that updates the build.version variable and provides other variants of version variables, such as a special version for NuGet
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="Meta (CaioProiete): Initialize build and set custom parameters">
<description>Initialize the build and set the value of some custom parameters that can be used during the build, such as version, timestamp, and others</description>
<settings>
<parameters>
<param name="mr.initialize_build.releaseBranch" value="%build.releaseBranch%" spec="text label='Release Branch:' description='The name of the branch from where production releases are generated' display='normal' validationMode='not_empty'" />
<param name="mr.initialize_build.verbose" value="SilentlyContinue" spec="checkbox checkedValue='Continue' description='Log verbose messages?' display='normal' label='Verbose:' uncheckedValue='SilentlyContinue'" />
</parameters>
<build-runners>
<runner name="Initialize build and set custom parameters" type="jetbrains_powershell">
@brettveenstra
brettveenstra / gist:6c6b7f926383b744b8038e14e6483409
Created December 6, 2016 14:57 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@brettveenstra
brettveenstra / octo-artifacts.ps1
Created August 9, 2017 16:57 — forked from rirl/octo-artifacts.ps1
Download ALL artifacts for a given deployment from Octopus Deploy to the artifacts directory
# Try it in powershell...
[Reflection.Assembly]::LoadFile("C:\Program Files\Octopus Deploy\Tentacle\Newtonsoft.Json.dll")
[Reflection.Assembly]::LoadFile("C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll")
[Reflection.Assembly]::LoadFile("C:\Program Files\Octopus Deploy\Tentacle\Octopus.Platform.dll")
# Basic data
Write-Host "Setup..."
$octoKey=" Your API Key"
$octoUser=" Your user name"
$octoId=" Your deployment id, ie (deployments-1492)"

Using P4Merge with Visual Studio 2015/2017

The diff tool integrated with Visual Studio has been improving with every version. I still prefer dedicated diff/merge tools for the job, however, and P4Merge is my favorite. This small guide describes how to properly integrate P4Merge with Visual Studio 2015.

Note that this only applies when using TFS. If you use git, Visual Studio will use the diff/merge tools configured with git.

Installing P4Merge

The easiest method of installing P4Merge on your computer is with Chocolatey:

#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@brettveenstra
brettveenstra / dupfinder.ps1
Created June 7, 2019 19:49 — forked from badmotorfinger/dupfinder.ps1
Use ReSharper command line tool dupFinder to produce a report of duplicated C# code
$reportFileName = 'dupfinder.html'
$dupFindLocation = 'C:\dev\tools\ReSharperCliTools\dupfinder.exe'
if (-not (Test-Path $dupFindLocation)) {
Write-Host "dupfinder.exe not found in path $dupFindLocation"
Write-Host "Download tools from https://www.jetbrains.com/help/resharper/2017.1/ReSharper_Command_Line_Tools.html"
exit
}
$xsl = '<?xml version="1.0" encoding="utf-8"?>