Skip to content

Instantly share code, notes, and snippets.

View mikeblakeuk's full-sized avatar

Mike Blake mikeblakeuk

View GitHub Profile
@mikeblakeuk
mikeblakeuk / fastCheckout.yaml
Created October 25, 2022 19:16
Fast sparse Checkout for Azure DevOps
parameters:
folders: '*'
steps:
- bash: |
set -ex
export ORIGIN=$(Build.Repository.Uri)
export REF=$(Build.SourceVersion)
export FOLDERS='${{ parameters.folders }}'
#RDP
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xrdp
hostname -I
#LCD
#NOT git clone https://github.com/goodtft/LCD-show.git
@mikeblakeuk
mikeblakeuk / refreshNugetFeeds.ps1
Created May 27, 2020 08:58
Refresh the DevOps NuGet Arifact feeds
#based on - https://dev.to/omiossec/getting-started-with-azure-devops-api-with-powershell-59nn
$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
mikeblakeuk / DevOpsSemVer.yml
Created September 11, 2019 08:46
How to SemVer using DevOps
variables:
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
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
{
[Subject(typeof(AggregateException))]
@mikeblakeuk
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
// http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/MonitorRemoteMachine
// Create the ServiceClient
public class ClientProvider
{
public IPowerBIClient CreatePowerBIClient()
{
var client = new PowerBIClient()
client.ApplyProxy("http://yourProxy:port");
@mikeblakeuk
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
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 https://github.com/haron/startssl-java and https://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html
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\build.cloudapp.net.pfx -storetype pkcs12
@mikeblakeuk
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 'http://www.google.co.uk'
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 'www.zoominfo.com/p/Mike-Blake/2461152' element 3, Page 4