Skip to content

Instantly share code, notes, and snippets.

View sixeyed's full-sized avatar

Elton Stoneman sixeyed

View GitHub Profile
@sixeyed
sixeyed / profile.ps1
Created November 1, 2018 11:25
PowerShell profile with a Linux-style prompt and aliases for common Docker commands
function Prompt(){
$W = Split-Path -leaf -path (Get-Location)
$prompt = Write-Prompt "$($env:UserName)@$($env:ComputerName):" -ForegroundColor Green
$prompt += Write-Prompt $W -ForegroundColor DarkCyan
$prompt += Write-Prompt '>'
return ' '
}
function Remove-StoppedContainers {
docker container rm $(docker container ls -q)
@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 / 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 / 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 / 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 / Set-ProfileForDocker.ps1
Last active December 2, 2024 20:30
PowerShell aliases for working with Docker on Windows - save to $profile
#docker rm $(docker ps -a -q)
function Remove-StoppedContainers {
foreach ($id in & docker ps -a -q) {
& docker rm $id }
}
#docker rmi $(docker images -f "dangling=true" -q)
function Remove-DanglingImages {
foreach ($id in & docker images -q -f 'dangling=true') {
& docker rmi $id }
@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 / StubEventHubSpout.cs
Last active September 7, 2015 13:42
Simple stub for emitting Event Hub-style tuples to Storm context, for testing .NET Storm applications. Usage here: https://blog.sixeyed.com/a-stub-event-hub-spout-for-testing-storm-net/
using Microsoft.SCP;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace My.Storm.App.Tests
{
/// <summary>
/// Simple stub for emitting Event Hub-style tuples to Storm context.
/// </summary>
@sixeyed
sixeyed / Program.cs
Created February 19, 2015 16:04
Submitting HDInsight Storm Applications from Visual Studio - Gotcha!
TopologyBuilder topologyBuilder = new TopologyBuilder("MyEventProcessorRealTimeStorm");
@sixeyed
sixeyed / ExecAsyncTask.proj
Created October 23, 2014 12:16
ExecAsync - simple inline MSBuild task for executing commands asynchronously
<UsingTask TaskName="ExecAsync" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
<exePath ParameterType="System.String" Required="true" />
<arguments ParameterType="System.String" Required="true" />
<waitMilliseconds ParameterType="System.Int32" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System.Diagnostics"/>
<Using Namespace="System.Threading"/>