Skip to content

Instantly share code, notes, and snippets.

Alastair Smith alastairs

Block or report user

Report or block alastairs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alastairs
alastairs / New-K8sClsuter.ps1
Created May 6, 2017
Deploy a new Kubernetes cluster to Azure Container Service using the Azure Command Line 2.0
View New-K8sClsuter.ps1
param(
[Parameter(Mandatory=$true)]
[string]$SshKeyFile,
[Parameter(Mandatory=$true)]
[string]$Location = "westeurope",
[string]$ResourceGroup = "k8s-$Location",
[string]$ClusterName = "k8s-$Location",
[string]$DnsPrefix = "ch360",
[int]$MasterCount = 1,
[int]$AgentCount = 3,
@alastairs
alastairs / Declarative.cs
Created Feb 5, 2017
Express Yourself! Motivating Example
View Declarative.cs
public int WhatDoIDo(int[] numbers)
{
return numbers.Count(i => i % 2 == 0)
}
@alastairs
alastairs / _init.ps1
Last active Nov 17, 2016
Code snippets for "How we do builds"
View _init.ps1
function global:build() {
 param(
  # The Tasks to execute. An empty list runs the 
  # default task, as defined in build.ps1
  [string[]] $Tasks = @(),
  [string] $Configuration = "Release",
  [string] $BuildNumber = '0'
  )
RestoreBuildLevelPackages
@alastairs
alastairs / top-left-accumulation.js
Last active May 13, 2016
Artificial Intelligence implementations for 2048
View top-left-accumulation.js
function Ai() {
this.UP = 0;
this.RIGHT = 1;
this.DOWN = 2;
this.LEFT = 3;
this.ORIGIN =
this.init = function() {
this.move = this.UP;
@alastairs
alastairs / ConsoleOutput.txt
Last active Aug 29, 2015
Topshelf with ASP.NET vNext
View ConsoleOutput.txt
Topshelf.HostFactory Error: 0 : An exception occurred creating the host, Topshel
f.HostConfigurationException: The service was not properly configured:
[Failure] Command Line An unknown command-line option was found: SWITCH: appbase
(True)
[Failure] Command Line An unknown command-line option was found: ARGUMENT: "C:\t
emp\TopShelfVNextIssue"
[Failure] Command Line An unknown command-line option was found: ARGUMENT: "Micr
osoft.Framework.ApplicationHost"
[Failure] Command Line An unknown command-line option was found: SWITCH: configu
ration (True)
@alastairs
alastairs / Json.cs
Created Apr 10, 2015
A simple type to wrap up a JSON string into an object that represents the concept of "a JSON string". Use this anywhere you want have to say "string" but really want to say "JSON".
View Json.cs
using System;
namespace RedGate.Cef.WebUI.Impl
{
/// <summary>
/// A simple type to wrap up a JSON string into an object that represents the concept of a JSON string.
/// Use this anywhere you have to say "string" but really want to say "JSON".
/// </summary>
[Serializable]
public class Json
View npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm@1.4.3
3 info using node@v0.10.26
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 warn package.json WebAssets@0.1.0 No README data
6 verbose readDependencies using package.json deps
7 verbose install where, deps [ 'D:\\Code\\SoC\\Source\\WebAssets',
@alastairs
alastairs / debug.log
Last active Dec 17, 2015
SaveAllTheTime debug.log
View debug.log
2013-05-13 21:44:23.1672 - WARN: *** Detected Unit Test Runner, setting MainThreadScheduler to Immediate ***
2013-05-13 21:44:23.1825 - WARN: If we are not actually in a test runner, please file a bug
2013-05-13 21:44:23.2136 - ERROR: Couldn't load settings, creating them from scratch
EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\alastair\AppData\Roaming\SaveAllTheTime\settings.json'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamReader
View credentials.ps1
$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"
View new-buildagents.ps1
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) {
You can’t perform that action at this time.