This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import uuid | |
import base64 | |
import sys | |
def base32decode(s): | |
# NB - input should be a hex string of 26 characters | |
padded_bytes = f"{s}======".encode('ascii') | |
decoded_bytes = base64.b32decode(padded_bytes, casefold=True) | |
# NB - bytes_le uses .NET Guid-compatible byte order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import uuid | |
import base64 | |
import sys | |
def base32encode(guid): | |
# NB - bytes_le order matches .NET Guid.ToByteArray() order | |
# cf. https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=net-6.0#system-guid-tobytearray | |
bytes = guid.bytes_le | |
encoded_bytes = base64.b32encode(bytes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xunit; | |
using StructureMap; | |
using StructureMap.Pipeline; | |
using System.Linq; | |
namespace StructureMapDemo | |
{ | |
public class UnitTest1 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt update | |
export WINEARCH="win32" | |
apt install wine | |
apt-get install cabextract | |
dpkg --add-architecture i386 && apt-get update && apt-get install wine32 | |
curl http://download.microsoft.com/download/D/D/3/DD35CC25-6E9C-484B-A746-C5BE0C923290/NDP47-KB3186497-x86-x64-AllOS-ENU.exe --output NDP47.exe | |
apt-get install wget unzip cabextract | |
curl https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks --output winetricks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FROM i386/ubuntu:latest | |
FROM i386/debian:latest | |
#Note: it is less messy to use 32-bit Wine, so we stick with i386 Linux distro | |
RUN apt-get update && \ | |
apt-get install -y curl unzip cabextract | |
#Install Wine | |
RUN apt-get install -y wine-development | |
WORKDIR /root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Registers a specimen builder for open generic type Lazy<>. | |
// When asked for a concrete instance of Lazy<T>, the specimen builder constructs it using a func that returns the concrete inner specimen T using the current fixture. | |
// So it works like: | |
// fixture.Register<Lazy<T>>( fixture, () => new Lazy<T>( () => fixture.CreateAnonymous<T>() ) ); | |
// where T is a runtime type | |
/// </summary> | |
class LazyCustomization : ICustomization | |
{ | |
public void Customize( IFixture fixture ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$computerName = "someazurevm.cloudapp.net" | |
$userName = "CONTOSO\myuser" | |
$password = "secret" | |
$cred = New-Object System.Management.Automation.PSCredential $userName, $(ConvertTo-SecureString $password -AsPlainText -Force) | |
Invoke-Command -ComputerName $computerName -Credential $cred -Port 62397 -UseSSL -FilePath .\deploy\MyUpgradeScript.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
function exec( [ScriptBlock] $cmd){ | |
( & $cmd ) 2>&1 # TeamCity doesn't show the output without the 2>&1 | |
if($LASTEXITCODE -ne 0){ | |
throw "Exec returned $LASTEXITCODE" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ExceptionsFacts | |
{ | |
[Theory, AutoData] | |
static void AllExceptionsShouldBeSerializable( SerializableAssertion assertion ) | |
{ | |
assertion.Verify( typeof( MyException ).Assembly.GetTypes() | |
.Where( x => typeof( Exception ).IsAssignableFrom( x ) ) ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Reflection; | |
using Xunit.Extensions; | |
namespace Prototypes.AutoFixture.Xunit.Extensions | |
{ | |
public class CompositeDataAttribute : DataAttribute |
NewerOlder