Skip to content

Instantly share code, notes, and snippets.

View johannesprinz's full-sized avatar

Johannes Prinz johannesprinz

View GitHub Profile
@johannesprinz
johannesprinz / Dotnet-New-Clean-Architecture
Last active March 19, 2021 04:48
Dotnet Core - Clean Architecture Scaffold
# Outside of shell
# - Create project directory
# - git init
# - open in vs code >code .
# - Using remote container extensions create new development container
# - Using dotnet core 3.1 or later container template
# - Re-open in container and run the script below
dotnet new sln
dotnet new xunit -n Application.IntegrationTests -o ./tests/Application.IntegrationTests
@johannesprinz
johannesprinz / Readme.md
Last active April 25, 2024 04:44
Migrating GitLab issues + history to Azure DevOps

Migrate-GitlabToDevops

Dependencies

You will need an access token from azure devops. Get yours here. This script will need contributor access to the project in question.

How to run

# populate user map in Map-IssueToWorkitem
@johannesprinz
johannesprinz / Test-Function.ps1
Created December 14, 2017 21:01
Basic advanced function template
function Test-Function {
[OutputType([String])]
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="None"
)]
param (
[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string]$Name
@johannesprinz
johannesprinz / Test-TimedProcessFunction.ps1
Last active December 3, 2017 23:13
Testing PowerShell function with timer and writing progress and also seeing the interesting pipeline management in action
function Test-TimedProcessFunction {
[OutputType([String])]
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="None"
)]
param (
[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string]$Name,
Include ".\references.ps1"
properties {
$dir = @{
msbuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319";
src = (Join-Path -Path $psake.build_script_dir -ChildPath '..' | Get-Item).FullName;
}
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")]
$tool = @{
msbuild = (Join-Path -Path 'C:\Program Files (x86)\MSBuild\14.0\Bin' -ChildPath 'MSBuild.exe' | Get-Item).FullName;
function Add-HostFileEntry {
[OutputType([String])]
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="Medium")]
param (
[Parameter(Position=1, Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidatePattern("(?# Valid IP Address range 1.1.1.1 - 255.255.255.255)\A(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\z")]
properties {
$dir = @{
base = (Get-Item -Path $psake.build_script_dir).FullName;
src = (Get-Item -Path (Join-Path -Path $psake.build_script_dir -ChildPath '..\')).FullName;
bin = Join-Path -Path $psake.build_script_dir -ChildPath "bin";
}
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")]
$tool = @{
mstest = (Get-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe").FullName;
}
@johannesprinz
johannesprinz / Print-TFSBranchHierarchy.ps1
Created December 21, 2016 01:03
PowerShell function to print out TFS Branch Hierarchy for all
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.Lab.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.Lab.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.VersionControl.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
$tfsCollectionUrl = New-Object System.URI("http://TFSServer:8080/tfs/CollectionName/");
$tfsCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsCollectionUrl);
$versionControl = $tfsCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]);