Skip to content

Instantly share code, notes, and snippets.

View vborovikov's full-sized avatar

Vladislav Borovikov vborovikov

  • Russia
View GitHub Profile
internal static class SafeNativeMethods
{
[DllImport("dwmapi", SetLastError = true)]
private static extern int DwmIsCompositionEnabled([MarshalAs(UnmanagedType.Bool)] out bool isEnabled);
public static bool SafeDwmIsCompositionEnabled()
{
bool result = false;
if (Environment.OSVersion.Version.Major >= 6)
{
@hyperupcall
hyperupcall / settings.jsonc
Last active December 27, 2025 05:31
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@davidfowl
davidfowl / Example.cs
Last active June 6, 2023 08:10
An implementation of MessagePipe. Something like a channel but with buffer management so you can peek and advance the message that was read.
using System.Buffers;
using System.Net.WebSockets;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/ws", async (HttpContext context) =>
{
const int MaxMessageSize = 1024 * 1024;
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;