Skip to content

Instantly share code, notes, and snippets.

View pbering's full-sized avatar

Per Bering pbering

View GitHub Profile
@pbering
pbering / gist:7821617
Last active December 30, 2015 11:19
MediaProvider Fix
public class Hello()
{
public void Test()
{
}
}
@pbering
pbering / gist:dc35f94360d73252a052
Created June 26, 2014 20:12
Log4Net Appender that submits errors to NewRelic
using System;
using System.Collections.Generic;
using log4net.Appender;
using log4net.spi;
using Sitecore.Data.Items;
namespace SitecoreDiagnostics.NewRelic
{
public class Log4NetErrorAppender : AppenderSkeleton
{
@pbering
pbering / view.cshtml
Last active May 23, 2016 15:44
which one
<!-- Classic Razor Html helper: -->
@await Html.Lightcore().PlaceholderAsync("menu")
<div class="page">
@await Html.Lightcore().PlaceholderAsync("content")
</div>
<p>@await Html.Lightcore.RenderField("title")</p>
@await Html.Lightcore.RenderField("text")
<!-- Or ASP.NET Core TagHelper: -->
@pbering
pbering / Logging.config
Last active August 13, 2016 10:18
Sitecore native UDP log streaming
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender, Sitecore.Logging">
<remoteAddress value="127.0.0.1" />
<remotePort value="9000" />
<layout type="log4net.Layout.PatternLayout, Sitecore.Logging">
<conversionPattern value="%a @@@ %d{ABSOLUTE} @@@ %t @@@ %p @@@ %c @@@ %m" />
</layout>
</appender>
@pbering
pbering / autopart.sh
Created July 27, 2016 12:49 — forked from trentmswanson/autopart.sh
Linux bash script to partition and format all data disks in azure
#!/bin/bash
# An set of disks to ignore from partitioning and formatting
BLACKLIST="/dev/sda|/dev/sdb"
# Base directory to hold the data* files
DATA_BASE="/media"
usage() {
echo "Usage: $(basename $0) <new disk>"
}
@pbering
pbering / gist:71aabc8a3224f257d56c2a249a0ccedf
Created September 16, 2018 18:35
urlrewite install in docker log
=== Verbose logging started: 9/17/2018 5:31:33 Build type: SHIP UNICODE 5.00.10011.00 Calling process: C:\Windows\System32\msiexec.exe ===
MSI (c) (C8:C8) [05:31:33:478]: Resetting cached policy values
MSI (c) (C8:C8) [05:31:33:478]: Machine policy value 'Debug' is 0
MSI (c) (C8:C8) [05:31:33:478]: ******* RunEngine:
******* Product: C:\install\urlrewrite.msi
******* Action:
******* CommandLine: **********
MSI (c) (C8:C8) [05:31:33:478]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (C8:C8) [05:31:33:478]: Grabbed execution mutex.
MSI (c) (C8:C8) [05:31:33:509]: Cloaking enabled.
@pbering
pbering / Dockerfile
Created September 16, 2018 19:17
urlrewrite docker reproduce
FROM microsoft/aspnet:4.7.2-windowsservercore-1803
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG URLREWRITE_MSI='c:\\install\\urlrewrite.msi'
ADD http://download.microsoft.com/download/D/D/E/DDE57C26-C62C-4C59-A1BB-31D58B36ADA2/rewrite_amd64_en-US.msi ${URLREWRITE_MSI}
RUN Start-Process $env:URLREWRITE_MSI -ArgumentList "/qn", "/l*v", "c:\log.txt" -PassThru | Wait-Process
@pbering
pbering / Performance.config
Last active January 29, 2023 12:20
Sitecore Performance (Docker friendly)
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="Sitecore.Pipelines.Loader.ShowVersion, Sitecore.Kernel">
<patch:delete />
</processor>
<processor type="Sitecore.Pipelines.Loader.ShowHistory, Sitecore.Kernel">
<patch:delete />
</processor>
@pbering
pbering / linux-docker-log.txt
Created January 3, 2019 13:12
docker log with debug enabled from linux host
-- Logs begin at Thu 2019-01-03 11:33:57 UTC, end at Thu 2019-01-03 11:45:56 UTC. --
Jan 03 11:36:29 dc2node-nvm0 systemd[1]: Starting Docker Application Container Engine...
Jan 03 11:36:29 dc2node-nvm0 dockerd[4183]: time="2019-01-03T11:36:29.139064323Z" level=info msg="systemd-resolved is running, so using resolvconf: /run/systemd/resolve/resolv.conf"
Jan 03 11:36:29 dc2node-nvm0 dockerd[4183]: time="2019-01-03T11:36:29.225100467Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Jan 03 11:36:29 dc2node-nvm0 dockerd[4183]: time="2019-01-03T11:36:29.225381975Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jan 03 11:36:29 dc2node-nvm0 dockerd[4183]: time="2019-01-03T11:36:29.225666683Z" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0 <nil>}]" module=grpc
Jan 03 11:36:29 dc2node-nvm0 dockerd[4183]: time="2019-01-03T11:36:29.225734985Z" level=info msg="ClientConn switching balancer to \"pick_first\"" modul
@pbering
pbering / windows-docker-log.csv
Last active January 3, 2019 13:27
docker log with debug enabled from windows host
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
"EventID","MachineName","Data","Index","Category","CategoryNumber","EntryType","Message","Source","ReplacementStrings","InstanceId","TimeGenerated","TimeWritten","UserName","Site","Container"
"2","dc2node-wvm0","System.Byte[]","461","(0)","0","Information","debug: Registering POST, /build","docker","System.String[]","2","1/3/2019 11:18:10 AM","1/3/2019 11:18:10 AM",,,
"2","dc2node-wvm0","System.Byte[]","462","(0)","0","Information","debug: Registering POST, /build/prune","docker","System.String[]","2","1/3/2019 11:18:10 AM","1/3/2019 11:18:10 AM",,,
"2","dc2node-wvm0","System.Byte[]","463","(0)","0","Information","debug: Registering POST, /build/cancel","docker","System.String[]","2","1/3/2019 11:18:10 AM","1/3/2019 11:18:10 AM",,,
"2","dc2node-wvm0","System.Byte[]","458","(0)","0","Information","debug: Registering POST, /volumes/create","docker","System.String[]","2","1/3/2019 11:18:10 AM","1/3/2019 11:18:10 AM",,,
"2","dc2node-wvm0","System.Byte[]","459","(0)","0","Information","debug: Registering POST, /vo