Skip to content

Instantly share code, notes, and snippets.

View meixger's full-sized avatar
💭
🚴‍♂️

Martin Meixger meixger

💭
🚴‍♂️
View GitHub Profile
@meixger
meixger / RoleNameContainer.cs
Created May 2, 2022 09:59
Azure App Service RoleName for Serilog
/// <summary>
/// We need to check the App Service Kudo header WAS-DEFAULT-HOSTNAME.
/// The environment variable "WEBSITE_HOSTNAME" will not be updated to production after swapping App Service slots.
/// </summary>
public class RoleNameContainer
{
// See internal class https://github.com/microsoft/ApplicationInsights-dotnet/blob/2.19.0/NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/Implementation/RoleNameContainer.cs
// https://github.com/microsoft/ApplicationInsights-dotnet/blob/51dc14afaf7de2b6902a10d6518d2d400cb61f67/NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HostingDiagnosticListener.cs#L192
private const string WebAppHostNameHeaderName = "WAS-DEFAULT-HOSTNAME";
@meixger
meixger / GetAllTableSizes.sql
Last active January 26, 2022 08:31
Sql GetAllTableSizes
CREATE PROCEDURE [dbo].[GetAllTableSizes]
AS
BEGIN
DECLARE @t TABLE
(name sysname,rows int,reserved nvarchar(40),data nvarchar(50),index_size nvarchar(50),unused nvarchar(50))
INSERT INTO @T EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"
SELECT name, rows,
Cast(Replace(reserved,' KB','') as float) as reservedBytes,
$exitCode = 0;
Write-Host "=== inetcons git hooks ==="
$devenv = Get-Process -Name devenv |where{$_.mainWindowTItle -like 'ContosoUniversity*'}
if($devenv)
{
Write-Host "Please close Visual Studio before rebasing."
$exitCode = 1;
}
exit $exitcode