Skip to content

Instantly share code, notes, and snippets.

@perosb
perosb / sitecore-dotnetcore-customcultures.md
Last active September 11, 2021 15:56
Sitecore 10.1 with .NET Core rendering and custom cultures on Linux

Sitecore 10.1 and .NET Core Rendering Host with Custom Cultures on Linux

In traditional Sitecore you can always install custom cultures using .NET Framework (unless you're on PaaS ;).

If you're running .NET Core RenderingHost on a alpine linux based container, you're options are a bit more limited. One way would be to build additional cultures into alpine but it's quite a hassle. You need to build the custom .dat file first etc.

However, it turns out that you can actually create new CultureInfo("en-IS") without them being installed. There is however one culprit, these cultures are not included in the GetCultures method. This method is used internally by Sitecore to validate the that the route contains a valid culture for the localization to work.

@perosb
perosb / Dockerfile
Created June 28, 2021 07:39
Sitecore 10.1 and kubernetes container for serialization
# escape=`
FROM mcr.microsoft.com/dotnet/sdk:3.1 as prep
ENV SITECORE_PUBLIC_NUGET_FEED=https://sitecore.myget.org/F/sc-packages/api/v3/index.json
ENV CM_HOST=
ENV ID_HOST=
ENV CLIENT=
ENV SECRET=
ENV ENVIRONMENT=dev
@perosb
perosb / docker-upgrade-windows.md
Last active April 26, 2021 09:40
Upgrade Docker for Windows Server
Find-Package -Name Docker -ProviderName DockerMSFTProvider
Install-Package -Name Docker -ProviderName DockerMSFTProvider -Update -Force
Restart-Service docker
@perosb
perosb / sitecore-101-container-solrcloud-rebuild.md
Last active June 18, 2021 11:37
Sitecore Container with SolrCloud SwitchOnRebuild

Sitecore Containers + SolrCloud with SwitchOnRebuild

The default solr-init container doesn't create any rebuild cores. So create them you need to modify the Start.ps1 script in the solr-init Dockerfile.

# escape=`

ARG PARENT_IMAGE
@perosb
perosb / sitecore-solr-init-custom-core.md
Last active April 6, 2021 11:32
How to create a custom solr core in Sitecore 10.1

Creating a custom core in Sitecore 10.1 using solr-init

Creating custom cores changed a bit in Sitecore 10.1 compared to 10.0 but it's still quite easy. You need to copy a "core configuration" json file in into the solr-init's \data folder. The entrypoint of solr-init will process everything here that follows the pattern:

  1. The core need to be prefixed with "sitecore_"
  2. The json file must be named cores-*.json

You need to create your own solr-init Dockerfile

# escape=`
@perosb
perosb / Dockerfile-for-crashed-solr.md
Last active March 6, 2021 07:01
Sitecore 10.1 patched solr Dockerfile to cleanup after crash

Sitecore 10.1 patched solr Dockerfile to cleanup after crash

Slr sometimes crashes in our dev setup leaving write.lockfiles around which causes problems during next start. The below removes the lock files prior to start.

Solr Dockerfile uses upstream sitecore as PARENT_IMAGE

Patch in a "Remove-Item" command somewhere in the Start.ps1

# escape=`
@perosb
perosb / ga
Last active November 4, 2017 13:16
ga hass
diff --git a/homeassistant/components/google_assistant/__init__.py b/homeassistant/components/google_assistant/__init__.py
index c5904354b..8b4ac56fb 100644
--- a/homeassistant/components/google_assistant/__init__.py
+++ b/homeassistant/components/google_assistant/__init__.py
@@ -56,9 +56,11 @@ CONFIG_SCHEMA = vol.Schema(
@bind_hass
+@asyncio.coroutine
def request_sync(hass):
@perosb
perosb / AspectRatioPlugin.cs
Last active December 24, 2015 03:49
ImageResizer AspectRatioPlugin
/// <summary>
/// A ImageResizerPlugin that uses a special ascpetratio command to calculate the height.
/// </summary>
/// <author>Per Osbäck</author>
public class AspectRatioPlugin : IPlugin
{
public AspectRatioPlugin()
{
}