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
$encryptionKey = (Get-Content "C:\EncryptionKey.txt") | |
$encryptionKey = [System.Text.Encoding]::Unicode.GetBytes($encryptionKey) | |
function Get-MyCredential { | |
$myPassword = Get-PasswordAsSecureString | |
return new-object System.Management.Automation.PSCredential "My.Username", $domainAdminPassword | |
} | |
function Get-PasswordAsSecureString { | |
return ConvertTo-SecureString -Key $encryptionKey "Place string representation of encrypted password here" |
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
param([String]$XenServerPoolMaster, [String]$TemplateName, [int]$NumberOfBuildAgents) | |
Add-PSSnapIn XenServerPSSnapin | |
. ".\credentials.ps1" | |
. ".\teamcity.ps1" | |
Connect-XenServer -Server $XenServerPoolMaster -Creds (Get-XenServerCredential) -NoWarnNewCertificates -NoWarnCertificates | |
function private:New-BuildAgentVM([string]$XenServerPoolMaster, [string]$templateName, [int]$buildAgentIndex) { |
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
param([string]$XenServerPoolMaster) | |
Add-PSSnapIn XenServerPSSnapin | |
. ".\credentials.ps1" | |
. ".\teamcity.ps1" | |
Connect-XenServer -Server $XenServerPoolMaster -Creds (Get-XenServerCredential) -NoWarnNewCertificates -NoWarnCertificates | |
Get-XenServer:VM -Server $XenServerPoolMaster |? { $_.tags -contains 'active' } |? { $_.name_label -ne $env:COMPUTERNAME } |% { |
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 (var session = documentStore.OpenSession()) | |
{ | |
session.Load<Concert>(1) | |
} |
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
private static readonly IEnumerable<Foo> BaseCollectionOfFoo = new List<Foo> | |
{ | |
new Foo(1), | |
new Foo(2), | |
new Foo(3) | |
}; | |
private static readonly IEnumerable<Foo> AllFoo = new List<Foo>(BaseCollectionOfFoo) | |
{ | |
new Foo(4) |
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
function Get-ScriptDirectory { | |
$invocation = (Get-Variable MyInvocation -Scope 1).Value | |
$script = [IO.FileInfo] $invocation.MyCommand.Path | |
if ([IO.File]::Exists($script)) { | |
return (Split-Path $script.Fullname) | |
} else { | |
return $null | |
} | |
} |
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 string GetPrettyPrintedJson(string json) | |
{ | |
dynamic parsedJson = JsonConvert.DeserializeObject(json); | |
return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); | |
} |
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 bool IsLeapYear(int year) | |
{ | |
return true; | |
} |
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
[TestFixture] | |
public class LeapYearCalculatorAcceptanceTests | |
{ | |
[Test] | |
public void TestThat_IsLeapYear_ShouldReturnTrue_WhenTheGivenYearIsATypicalLeapYear() | |
{ | |
const int typicalLeapYear = 1996; | |
var isLeapYear = LeapYearCalculator.IsLeapYear(typicalLeapYear); |
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
Write a function that returns true or false depending on whether its input integer is a leap year or not. | |
A leap year is divisible by 4, but is not otherwise divisible by 100 unless it is also divisible by 400. | |
2001 is a typical common year | |
1996 is a typical leap year | |
1900 is an atypical common year | |
2000 is an atypical leap year |