Skip to content

Instantly share code, notes, and snippets.

View PaulStovell's full-sized avatar

Paul Stovell PaulStovell

View GitHub Profile
@PaulStovell
PaulStovell / gist:9381247
Created March 6, 2014 02:42
Default Azure deployment script
## Octopus Azure deployment script, version 1.0
## --------------------------------------------------------------------------------------
##
## This script is used to control how we deploy packages to Windows Azure.
##
## When the script is run, the correct Azure subscription will ALREADY be selected,
## and we'll have loaded the neccessary management certificates. The Azure PowerShell module
## will also be loaded.
##
## If you want to customize the Azure deployment process, simply copy this script into

This is a work-in-progress script that automatically:

  1. Downloads the Tentacle MSI
  2. Installs it
  3. Installs and configures a Tentacle instance
  4. Registers the Tentacle with an Octopus server in "polling" mode

Remember to replace the settings at the bottom.

The script works great on EC2 as well. When creating a machine in EC2, paste the script between `` tags into the User Data section (in the EC2 management console, this is on the Configuration tab when creating a machine).

@PaulStovell
PaulStovell / text.md
Last active June 4, 2020 06:35
Microsoft/OSS relationship

This follows from Aaron's post and this set of tweets

Sometimes Microsoft build things that replace or compete with OSS and community alternatives. This upsets a bunch of people and it's been written about plenty.

These two pages in docs.microsoft.com are really nice counter examples - while they show the built-in Microsoft solutions, they also mention other OSS options, and even link to them:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1

A much better example, Microsoft shipped a replacement for JSON serialization. I think that this page is really good:

@PaulStovell
PaulStovell / IDocument.cs
Last active April 25, 2020 09:51
Nevermore marker interfaces & shims
namespace Nevermore.Contracts
{
public interface IDocument : IId, INamed
{
}
}
@PaulStovell
PaulStovell / Xero Helper.js
Last active March 5, 2019 05:20
A TamperMonkey script that lets you easily find and match multiple transactions in Xero to reconcile.
// ==UserScript==
// @name Xero Bank Rec Helper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://go.xero.com/Bank/BankRec.aspx*
// @grant none
// ==/UserScript==
@PaulStovell
PaulStovell / Test.cs
Created November 2, 2011 18:33
SHA512Managed is not thread safe
static void Main(string[] args)
{
var hashAlgorithm = SHA512.Create();
var text = "Hello world";
var bytes = Encoding.Default.GetBytes(text);
var hashes = new List<string>();
Parallel.For(0, 10000, ignored =>
@PaulStovell
PaulStovell / Bootstrapper.cs
Created May 9, 2013 10:03
The Octopus Nancy error handling strategy
protected override void RequestStartup(ILifetimeScope requestContainer, IPipelines pipelines, NancyContext context)
{
pipelines.OnError.AddItemToEndOfPipeline((z, a) =>
{
log.Error("Unhandled error on request: " + context.Request.Url + " : " + a.Message, a);
return ErrorResponse.FromException(a);
});
base.RequestStartup(requestContainer, pipelines, context);
}

Octopus + Docker in a nutshell

Currently, Octopus deploys NuGet packages to destination machines, and handles all the orchestration around the deployment.

From an application packaging point of view, a NuGet package is similar to a Docker container image:

  • To build a NuGet package, we take your code, compile it, and bundle the results into a package, and give it a version stamp.
  • To build a Docker image, we take a Dockerfile, and run docker build, and it creates an image with a version stamp

From a deployment orchestation point of view, the two are also very similar:

@PaulStovell
PaulStovell / Group.cs
Created March 31, 2012 11:15
Hierarchies in RavenDB
public class Group
{
public Group()
{
Users = new List<string>();
ChildGroups = new List<string>();
}
public string Id { get; set; }
public string Name { get; set; }
@PaulStovell
PaulStovell / PowerShell invoker.cs
Created February 26, 2013 12:00
Invoking PowerShell, with variables
using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Management.Automation;
using System.Text;
using PowerShellHosting.Util;
namespace PowerShellHosting.File
{
public class FileBasedPowerShellRunner : IPowerShell