Skip to content

Instantly share code, notes, and snippets.

@mtmk
mtmk / Program.cs
Last active February 11, 2025 19:33
NATS .NET KV TryGet Example
// dotnet new console
// dotnet add package nats.net
// Program.cs:
using System.Net.Http.Json;
using System.Text.RegularExpressions;
using NATS.Net;
// You can create a free account on https://cloud.synadia.com and
// download your credentials file; find your user, click on
// 'Get Connected' then 'Download Credential' buttons.
@mtmk
mtmk / READEME.md
Last active February 12, 2024 14:32
nats-r3
public Program
{
static void Main()
{
Logger.Init();
var log = Logger.Get("main");
log.Info("Logging now..");
}
}
@mtmk
mtmk / WindowsService.cs
Last active July 27, 2018 05:40
Boilerplate Windows Service in C#
// reference System.ServiceProcess
// nuget install log4net
class Program : ServiceBase
{
static readonly ILog Logger = LogManager.GetLogger("main");
static void Main(string[] args)
{
// Configure logging
log4net.Config.XmlConfigurator.Configure(new FileInfo(Path.Combine(AssemblyDirectory, "log4net.config")));
@mtmk
mtmk / LuceneNetExample.cs
Last active April 3, 2024 12:47
Quick and complete Lucene.Net example
using System;
using System.Globalization;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.QueryParsers;
using Lucene.Net.Search;
using Lucene.Net.Store;
using Version = Lucene.Net.Util.Version;