Skip to content

Instantly share code, notes, and snippets.

@shanselman
shanselman / Dockerfile
Last active November 10, 2023 19:17
Smarter ASP.NET Core Docker File
FROM microsoft/dotnet:2.0-sdk as builder
RUN mkdir -p /root/src/app/aspnetcoreapp
WORKDIR /root/src/app/aspnetcoreapp
#copy just the project file over
# this prevents additional extraneous restores
# and allows us to resuse the intermediate layer
# This only happens again if we change the csproj.
# This means WAY faster builds!
@dvdstelt
dvdstelt / PackageVersionsUsedInDeployments.cs
Created April 29, 2016 05:50
LINQPad script for retrieving package versions used in deployments
var endpoint = new OctopusServerEndpoint("http://54.169.230.0:8085/", "API-xxxxxxxxxxxxxxxxxxxxxxxxxx");
var client = new OctopusClient(endpoint);
var repo = new OctopusRepository(client);
var projects = repo.Projects.GetAll().Select (p => repo.Projects.Get(p.Id));
var allDeployments = projects.SelectMany(p=>repo.Deployments.FindMany(d=>d.ProjectId.Equals(p.Id)).Take(5)).GroupBy (p => p.ProjectId).SelectMany (p => p);
var nugetPackageIds = new List<string>(new string[]{"Webshop.Frontend", "Webshop.Backend", "Webshop.BusinessRules", "Webshop.Messages"});
foreach(var deployment in allDeployments)
@michaellwest
michaellwest / Disable Sitecore 8 Analytic configs.ps1
Last active August 29, 2015 14:21
Quickly disable Sitecore Analytic configs
$paths = @("C:\inetpub\wwwroot\Console\Website\App_Config\Include\*","C:\inetpub\wwwroot\Demo\Website\App_Config\Include\*")
$patterns = @("Sitecore.Analytics*.config", "Sitecore.ExperienceAnalytics*.config")
$paths | Get-ChildItem -Include $patterns -Recurse | Rename-Item -NewName { $PSItem.Name + ".disabled" }
@DotTech
DotTech / gist:b075b6fd2e175c77a173
Created October 1, 2014 08:14
Sitecore xDB: Install & start MongoDB as Windows service
$service = Get-WmiObject -Class Win32_Service -Filter "Name='MongoDB'"
if ($service -eq $null)
{
$MongoPath = "d:\mongo\mongod.exe"
$MongoLogPath = "d:\mongo\logs\mongod.log"
$MongoDataFolder = "d:\mongo\data"
$binaryPath = "`"$MongoPath`" --service --logpath `"$MongoLogPath`" --dbpath `"$MongoDataFolder`""
New-Service -Name MongoDB -BinaryPathName $binaryPath -Description "MongoDB for Sitecore EMS" -DisplayName "MongoDB" -StartupType auto | Out-Null