Skip to content

Instantly share code, notes, and snippets.

View mikeblakeuk's full-sized avatar

Mike Blake mikeblakeuk

View GitHub Profile
mikeblakeuk / fastCheckout.yaml
Created October 25, 2022 19:16
Fast sparse Checkout for Azure DevOps
folders: '*'
- bash: |
set -ex
export ORIGIN=$(Build.Repository.Uri)
export REF=$(Build.SourceVersion)
export FOLDERS='${{ parameters.folders }}'
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xrdp
hostname -I
#NOT git clone
mikeblakeuk / refreshNugetFeeds.ps1
Created May 27, 2020 08:58
Refresh the DevOps NuGet Arifact feeds
#based on -
$feedname = "central"
$PackageName = "MyNew.Package"
$PackageVersion = "1.0.1-preview"
$AzureDevOpsPAT = "YOUR PAT" # Ideally use the az Nuget Creditials provider.
$OrganizationName = "MyOrg"
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($AzureDevOpsPAT)")) }
mikeblakeuk / DevOpsSemVer.yml
Created September 11, 2019 08:46
How to SemVer using DevOps
majorMinor: $[ format('{0:yyyy}.{0:M}', pipeline.startTime) ] #or 1.2
buildCounter: $[ counter(format('{0}_{1}', variables['Build.BuildName'], variables['Build.SourceBranchName']), 1) ]
develop_Branch: $[ format('{0}.{1}', variables['majorMinor'] , variables['buildCounter']) ]
preReleaseBranch: $[ format('{0}-{1}', variables['develop_Branch'], variables['Build.SourceBranchName']) ]
semVer: $[ coalesce(variables[format('{0}{1}', variables['Build.SourceBranchName'], '_Branch')], variables['preReleaseBranch']) ]
name: $(semVer)+$(BuildID)
mikeblakeuk / GetBaseException.cs
Last active November 7, 2019 15:58
GetBaseException vs InnerException
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Machine.Specifications;
// ReSharper disable PossibleNullReferenceException when getting InnerException from AggregateException
namespace Tests
mikeblakeuk / ApplyProxy.cs
Created July 20, 2018 09:22
Adding a proxy to azure clients c# for fiddler
// Install Fiddler on a VM and open the port it listens too. Remember to enable remote connections
// Create the ServiceClient
public class ClientProvider
public IPowerBIClient CreatePowerBIClient()
var client = new PowerBIClient()
mikeblakeuk / PowerBIHttpOperationExceptionHandler.cs
Last active March 1, 2023 23:17
PowerBIHttpOperationExceptionHandler - converts error to exceptions for power bi calls (to include the real message from the header)
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
namespace PowerBI
mikeblakeuk / AddCerts.cmd
Last active June 9, 2016 12:39
Getting HTTPS to work on TeamCity Agents with a self cert pfx
echo For my cloud agents, I had to get the pfx alias, Import the CARoot.cer, merge the pfx, and then change the password.
echo Based on and
cd %~dp0
set JAVA_HOME=C:\BuildAgent\jre
set KEYTOOL=%JAVA_HOME%\bin\keytool
set KEYSTORE=%JAVA_HOME%\lib\security\cacerts
set PASSWORD=changeit
echo "Importing StartSSL certificates into %KEYSTORE%" > run.log
rem C:\BuildAgent>jre\bin\keytool -list -keystore .\conf\ssl\ -storetype pkcs12
mikeblakeuk / Results
Created November 22, 2013 15:44
Sample Selenium SEO searcher. Given target urls and a list of search, look for the page/element ranking. It uses Selenium so hopefully google won't think it's automated. Need to save the results and stuff...
looking for 'mikeblakeuk' at ''
About 22,600 results (0.16 seconds)
10 cite elements on page 1
Page 2 of about 22,600 results (0.10 seconds)
10 cite elements on page 2
Page 3 of about 22,600 results (0.11 seconds)
10 cite elements on page 3
Page 4 of about 22,600 results (0.12 seconds)
10 cite elements on page 4
Found '' element 3, Page 4