Skip to content

Instantly share code, notes, and snippets.

View INTERNALINTERFERENCE's full-sized avatar
:octocat:
Working from home

whowantswhat INTERNALINTERFERENCE

:octocat:
Working from home
View GitHub Profile
using System.Device.Gpio;
using System.Device.Gpio.Drivers;
var _gpioController = new GpioController(
numberingScheme: PinNumberingScheme.Logical,
driver: new SysFsDriver());
var relayPin = 128 + 18;
Console.WriteLine("open pin");
namespace testchannels
{
internal class Program
{
private static readonly AsyncQueue<bool> _asyncQueue = new();
static async Task Main(string[] args)
{
await _asyncQueue.Enqueue(SetStateOn());
var key = Console.ReadKey().Key;
namespace testchannels
{
internal class Program
{
private static BlockingCollection<Action> _queue = new();
private static CancellationTokenSource _currentCts;
private static object _sync = new();
static async Task Main(string[] args)
{
@INTERNALINTERFERENCE
INTERNALINTERFERENCE / .cs
Created November 29, 2022 11:51
processor
public class LedStateTimedProcessor
: Disposable
{
private readonly Timer _timer;
private readonly object _sync = new();
private OutputLedColorType _color;
public LedStateTimedProcessor( OutputLedColorType color )
{
public class LedStateTimedProcessor
: Disposable
{
private readonly Timer _timer;
private readonly object _sync = new();
private OutputLedColorType _color;
public LedStateTimedProcessor( OutputLedColorType color )
{
@INTERNALINTERFERENCE
INTERNALINTERFERENCE / .cs
Created November 29, 2022 23:21
for test
// запускать можно вот так:
/*
LedStateTimedProcessor buzzerStateTimedProcessor = new( OutputLedColorType.Green);
buzzerStateTimedProcessor.StateChanged += type => Console.WriteLine( type );
buzzerStateTimedProcessor.DurationOn( arguments: new OutputLedOnArguments
{
Duration = TimeSpan.FromSeconds(30),
Alternating = new OutputLedAlternatingState()
{
Color = OutputLedColorType.Red,
public class Trie : ViewModelBase
{
public Trie(
string part,
int level,
Trie? root = null,
Trie? parent = null )
{
Part = part;
Level = level;
@INTERNALINTERFERENCE
INTERNALINTERFERENCE / .cs
Last active February 2, 2023 11:31
Tree logic
public class TreeNode
: ViewModelBase
{
protected TreeNode(string part)
: this( part, -1, null)
{
}
private TreeNode(
public class TreeNode
{
protected TreeNode(string part)
: this(part, -1, null)
private TreeNode(
string part,
int level,
TreeNode? parent)
{
static public class Json
{
static private readonly ConcurrentDictionary<Type, JsonShouldSerialize> _shouldSerializeAnalyzers =
new();
static private readonly JsonSerializerSettings DefaultSerializerSettings =
new JsonSerializerSettings()
.Apply( settings =>
{
settings.Converters.Add( new ExceptionJsonConverter() );