Skip to content

Instantly share code, notes, and snippets.

View sixeyed's full-sized avatar

Elton Stoneman sixeyed

View GitHub Profile
@sixeyed
sixeyed / ContentCache.cs
Created June 4, 2014 15:18
WebApi caching passthrough controller - passthrough JSON from another URL, using simple in-memory cache
using System;
using System.Runtime.Caching;
using System.Web.Http;
using System.Xml;
namespace Sixeyed.Api.Core
{
public class ContentCache
{
private static MemoryCache _Cache;
@sixeyed
sixeyed / overlay-test.ps1
Created May 5, 2017 20:13
Overlay test for Windows containers
$ip = '127.0.0.1'
docker swarm init --listen-addr $ip --advertise-addr $ip
docker network create --driver overlay test
docker service create `
--network test `
--endpoint-mode dnsrr `
--publish mode=host,target=80,published=80 `
@sixeyed
sixeyed / 01-run-on-azure.ps1
Last active May 31, 2017 13:19
Secure Docker engine on Azure VM and copy certs to local
$serverName = 'my.server.region.cloudapp.azure.com'
$externalIP = '1.2.3.4'
$internalIP = '10.0.0.4'
mkdir -p C:\certs\vm\client
docker run --rm `
-e SERVER_NAME= $serverName `
-e IP_ADDRESSES=127.0.0.1,$externalIP,$internalIP `
-v 'C:\ProgramData\docker:C:\ProgramData\docker' `
@sixeyed
sixeyed / IHttpActionResultExtensions.cs
Created April 8, 2014 12:45
Wrapping WebApi IHttpActionResult to expose the response message to controllers
using SampleApi.Results;
using System;
using System.Net.Http;
using System.Web.Http;
namespace SampleApi
{
public static class IHttpActionResultExtensions
{
public static IHttpActionResult With(this IHttpActionResult inner, string responsePhrase = null, Action<HttpResponseMessage> responseAction = null)
@sixeyed
sixeyed / simple-windows-stack.yml
Created March 14, 2018 22:52
The simplest Windows stack to run in a Docker swarm
version: '3.3'
services:
web:
image: microsoft/iis:nanoserver
networks:
- app-net
ports:
- mode: host
@sixeyed
sixeyed / install-ide.ps1
Last active June 21, 2018 13:58
Install .NET & Java IDEs
choco install -y visualstudio2017enterprise
choco install -y intellijidea-ultimate
choco install -y dotnetcore-sdk
choco install -y jdk8
@sixeyed
sixeyed / update-docker.ps1
Created September 28, 2016 23:03
Update Docker for Windows Server 2016
# Upgrades an existing Docker installation on Windows Server 2016
# Assumes you have Docker already installed by following the steps in https://blog.sixeyed.com/1-2-3-iis-running-in-nano-server-in-docker-on-windows-server-2016/
Stop-Service docker
dockerd.exe --unregister-service
Invoke-WebRequest "https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip" -OutFile "$env:TEMP\docker.zip" -UseBasicParsing
@sixeyed
sixeyed / windows_on_kube_dceu.md
Created November 30, 2018 13:25 — forked from wsong/windows_on_kube_dceu.md
Kube on Windows demo for DCEU

Windows on Kube

NOTE: This is based on the gist https://gist.github.com/wsong/34beb37ebd5d22c1bf1266aaeea085d4. That gist was used to set up the Dockercon SF demo; this one is for Dockercon EU 2018.

The below instructions describe how to set up a cluster with one Linux manager and one Windows worker such that you can schedule Kubernetes pods with Windows images on the Windows worker.

These instructions are for a Windows Server 2019 node. You can create these nodes on Azure (as of November 27, 2018).

On Azure, I recommend VMs of size D4s v3 or larger (4 CPUs, 16GB memory)

@sixeyed
sixeyed / DiagnosticCheckCollection.cs
Created January 15, 2014 21:29
Generic server diagnostics - with WebApi controller sample
using System.Collections.Generic;
namespace Sixeyed.Diagnostics.Models
{
public class DiagnosticCheckCollection
{
public string CollectionName { get; set; }
public bool? Passed { get; set; }
@sixeyed
sixeyed / QueueClient.cs
Created October 11, 2013 19:38
A wrapper for the SQS client in the AWS SDK for.NET v2, which uses the message-pump pattern
using Amazon;
using Amazon.SQS;
using Amazon.SQS.Model;
using Amazon.SQS.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Sixeyed.Blogging.Aws