Skip to content

Instantly share code, notes, and snippets.

View noseratio's full-sized avatar

Andrew Nosenko noseratio

View GitHub Profile
@noseratio
noseratio / copilot-cli-oh-my-posh-statusline.md
Created May 12, 2026 21:28 — forked from shanselman/copilot-cli-oh-my-posh-statusline.md
Use Oh My Posh for the GitHub Copilot CLI statusline

Use Oh My Posh for the GitHub Copilot CLI statusline

GitHub Copilot CLI has an experimental statusline feature that can run a local command and render the command's output at the bottom of the Copilot terminal UI.

If you already use Oh My Posh, you can use the same engine, colors, and segments to render a Copilot-aware statusline in a few minutes.

This guide shows a Windows + PowerShell setup, but the idea is portable:

  1. Copilot calls a local script.
  2. Copilot sends session state to the script as JSON on stdin.
@noseratio
noseratio / Agent.py
Created July 7, 2025 14:48 — forked from codeninja/Agent.py
A Google ADK Agentic team to update mongoose from version 6 to version 8.
from google.adk.agents import Agent
from google.adk.events import Event
from google.adk.agents.invocation_context import InvocationContext
from google.genai.types import Content, Part
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
from google.adk.tools.mcp_tool import StdioConnectionParams, StreamableHTTPConnectionParams, SseConnectionParams
from google.adk.tools.agent_tool import AgentTool
from pydantic import BaseModel, Field
from mcp import StdioServerParameters
@noseratio
noseratio / SwitchTo.cs
Last active May 2, 2023 11:17
TaskScheduler.Default.SwitchTo
// md wfapp
// dotnet new winforms
// then copy/paste this
using System.Diagnostics;
namespace wfapp;
public partial class Form1 : Form
{
@noseratio
noseratio / wfapp.cs
Created November 28, 2022 10:00
CF pushes us to ThreadPool
// https://twitter.com/noseratio/status/1597159958734217217
using System.Diagnostics;
namespace wfapp;
public partial class Form1 : Form
{
// library code
private static async Task LibApiAsync(Func<Task> waitForEvent)
@noseratio
noseratio / DebugSyncContext.cs
Last active November 9, 2023 19:16
A simple helper SynchronizationContext to debug deadlocks
// A helper SynchronizationContext to debug deadlocks by @noseratio
// If you install DebugSyncContext at the very beginning of your console app and run it under debugger,
// it should stop where the deadlock is happening, with a better access to the stack frame.
using System.Diagnostics;
SynchronizationContext.SetSynchronizationContext(new DebugSyncContext());
Console.WriteLine("Hello!");
@noseratio
noseratio / AsyncQueue.cs
Last active November 9, 2023 19:18
Simple async wrapper around .NET Queue
public sealed class AsyncQueue<T>: IAsyncDisposable
{
private readonly Queue<T> _queue = new();
private readonly SemaphoreSlim _semaphore = new(initialCount: 1, maxCount: 1);
private readonly CancellationTokenSource _cts = new();
private TaskCompletionSource _itemTcs = new(TaskCreationOptions.RunContinuationsAsynchronously);
public async ValueTask<(bool, T)> TryPeekAsync(CancellationToken cancelToken)
{
await _semaphore.WaitAsync(cancelToken);
@noseratio
noseratio / GenHostConApp.cs
Last active May 2, 2023 11:18
A minimal console app using .NET Generic Host API
// https://twitter.com/noseratio/status/1535173151910350848
// https://docs.microsoft.com/en-us/dotnet/core/extensions/generic-host
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using var host = Host.CreateDefaultBuilder(Environment.GetCommandLineArgs())
.ConfigureLogging(
logging =>
@noseratio
noseratio / LazyVsNoLazy.cs
Created June 9, 2022 23:41
Lazy vs no Lazy for IObservable pipeline construction
// by Theodor Zoulias
// https://stackoverflow.com/questions/72558093/in-rx-net-how-do-i-make-a-subject-to-resemble-taskcompletionsource-behavior/72561100?noredirect=1#comment128188846_72561100
//
// comment out "#define USING_LAZY"
#define USING_LAZY
using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Threading.Tasks;
@noseratio
noseratio / RxWithCancellation.cs
Last active February 14, 2024 00:17
Cancelling an observable with a CancellationToken
// https://stackoverflow.com/q/72471152/1768303
// https://dotnetfiddle.net/bLYDgw
/*
I don't think I should be seeing "Emitting: 19" after "Cancelling"
Emitting: 18
TakeUntil passed: 18
OnNext: 18
Cancelling
@noseratio
noseratio / rx-net-resources.md
Last active May 2, 2023 11:19
Rx .NET Resources