This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ILogger logger = null;// Get logger | |
var appDomain = AppDomain.CurrentDomain; | |
appDomain.UnhandledException += (sender, ea) => Log.Fatal((Exception)ea.ExceptionObject, "UnhandledException"); | |
if (logger.IsEnabled(LogEventLevel.Debug)) | |
{ | |
appDomain.FirstChanceException += (sender, ea) => | |
{ | |
var ex = ea.Exception; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DispatchedBefore datetime = GETUTCDATE()-1 -- Removes entries older then 24 hours | |
DECLARE @BatchSize INT = 4000 -- Avoid batch sizes over 4.000 to prevent lock escalation | |
WHILE 1 = 1 | |
BEGIN | |
DELETE TOP (@BatchSize) FROM [dbo].[EndpointNameOutboxData] WITH (ROWLOCK) | |
WHERE Dispatched = 'true' AND DispatchedAt < @DispatchedBefore; | |
IF @@ROWCOUNT < @BatchSize -- Important that @@ROWCOUNT is read immediately after the DELETE | |
BREAK | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// endpointConfiguration.Pipeline.Register(new ReportFailedDurationsBehavior(), nameof(ReportFailedDurationsBehavior)); | |
// | |
class ReportFailedDurationsBehavior : IBehavior<IIncomingLogicalMessageContext, IIncomingLogicalMessageContext> | |
{ | |
static readonly ILog Log = LogManager.GetLogger(typeof(ReportFailedDurationsBehavior)); | |
static readonly bool IsDebugEnabled = Log.IsDebugEnabled; | |
static readonly TimeSpan WarningThreshold = TimeSpan.FromSeconds(30); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Echo the commands as they're run | |
Set-PSDebug -Trace 1 | |
# Dump Windows version | |
Get-ComputerInfo | Format-Table WindowsVersion, OsVersion | |
# Create a UEFI VM, secure boot enabled, use the secure boot settings for the | |
$vm = New-VM -Generation 2 -Name "Fedora 38" -Path . | |
$vm | Set-VMFirmware -EnableSecureBoot On -SecureBootTemplate "MicrosoftUEFICertificateAuthority" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If all handlers are compute bound or IO isn't happening early it can result in less concurrent processing as depending on the | |
// transport and it being full async and no IO is happening message processing could be sequential. This behavior will immediately | |
// do a Task.Run | |
// | |
// Usage: | |
// endpointConfiguration.Pipeline.Register(new TaskRunBehavior(), nameof(TaskRunBehavior)); | |
// | |
class TaskRunBehavior : IBehavior<IIncomingPhysicalMessageContext, IIncomingPhysicalMessageContext> | |
{ | |
public Task Invoke(IIncomingPhysicalMessageContext context, Func<IIncomingPhysicalMessageContext, Task> next) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
static class PathWalker | |
{ | |
public static string Find(string filename, string path) | |
{ | |
if (filename == null) throw new ArgumentNullException(nameof(filename)); | |
if (path == null) throw new ArgumentNullException(nameof(path)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using NServiceBus; | |
using NServiceBus.Logging; | |
using NServiceBus.Raw; | |
using NServiceBus.Routing; | |
using NServiceBus.Transport; | |
CancellationTokenSource cts = new(); | |
Console.CancelKeyPress += (s, ea) => | |
{ | |
ea.Cancel = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
using System.Runtime.Loader; | |
/// <summary> | |
/// Based on: | |
/// | |
/// - https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'DROP TABLE ' + '[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']' | |
FROM INFORMATION_SCHEMA.TABLES | |
ORDER BY TABLE_SCHEMA, TABLE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netsh advfirewall firewall add rule name="ServicePulse - TCP 9090" dir=in action=allow protocol=TCP localport=9090 | |
netsh advfirewall firewall add rule name="ServiceControl - TCP 33333" dir=in action=allow protocol=TCP localport=33333 | |
netsh advfirewall firewall add rule name="ServiceControl.Monitoring - TCP 33633" dir=in action=allow protocol=TCP localport=33633 | |
netsh advfirewall firewall add rule name="ServiceControl.Audit - TCP 44444" dir=in action=allow protocol=TCP localport=44444 |