Skip to content

Instantly share code, notes, and snippets.

app.MapGet("/ai-config", (TelemetryConfiguration telemetryConfiguration) =>
{
var sb = new System.Text.StringBuilder();
sb.AppendLine("===== TelemetryConfiguration =====");
sb.AppendLine($"Connection String: {telemetryConfiguration.ConnectionString}");
sb.AppendLine($"Instrumentation Key: {telemetryConfiguration.InstrumentationKey}");
sb.AppendLine($"EnableAdaptiveSampling: {telemetryConfiguration.DefaultTelemetrySink.TelemetryProcessorChainBuilder.IsBuilt}");
sb.AppendLine("\n--- TelemetryInitializers ---");
foreach (var initializer in telemetryConfiguration.TelemetryInitializers)
peer.on("signal", (data) => {
console.log("🔹 Peer generated signal data:", data);
if (isInitiator) {
console.log("🔹 [Initiator] Generating OFFER:", JSON.stringify(data));
hubConnection.invoke("SendOffer", streamId, JSON.stringify(data))
.then(() => console.log("✅ [Initiator] Offer sent successfully."))
.catch((err) => console.error("❌ [Initiator] Error sending Offer:", err));
} else {
console.log("🔹 [Receiver] Generating ANSWER:", JSON.stringify(data));
public async Task<IActionResult> Syslog(string param = "-r -u eevatest.service --since \"2 days ago\"")
{
var p = new Process
{
StartInfo = {
FileName = "/usr/bin/journalctl",
Arguments = param,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
{ "arguments": ["just a test"], "target": "HubMethod", "type": 1 }
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Console.WriteLine("Poller task started.");
try
{
await InitializePrices();
}
catch (Exception ex)
{
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS publish
WORKDIR /src
COPY . .
ARG TARGETARCH
ARG VERSION
RUN dotnet publish MyProject.csproj -c Release --self-contained true \
options.Events = new OpenIdConnectEvents
{
OnAuthenticationFailed = context =>
{
Console.WriteLine(context.Exception);
return Task.CompletedTask;
},
OnTokenResponseReceived = context =>
{
Console.WriteLine(context.TokenEndpointResponse?.Content);
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context,
AppRolesAuthorizeAttribute requirement)
{
string rolesString = requirement.Roles;
string[] roles = rolesString.Split(",");
foreach (string entry in roles)
{
string role = entry.Trim();
if (!context.User.IsInRole(role))
public class MefServiceProvider : IServiceProvider
{
private readonly IDependencyResolver m_resolver;
private readonly ServiceProvider m_defaultServiceProvider;
public MefServiceProvider(IDependencyResolver resolver, ServiceProvider defaultServiceProvider)
{
m_resolver = resolver ?? throw new ArgumentNullException(nameof(resolver));
m_defaultServiceProvider = defaultServiceProvider ?? throw new ArgumentNullException(nameof(defaultServiceProvider));
}
using Microsoft.AspNetCore.Routing;
public class FolderRouteConstraint : IRouteConstraint
{
private readonly string[] _folders;
public FolderRouteConstraint(params string[] folders)
{
_folders = folders;
}