Skip to content

Instantly share code, notes, and snippets.

View thargy's full-sized avatar
🏠
Working from home

Craig Dean thargy

🏠
Working from home
View GitHub Profile
@thargy
thargy / LoveLace-Power-Flow-Plus.yaml
Last active January 5, 2024 16:28
Home Assistant package for solaredge sensors (2 inverters, 2 batteries, 2 solar)
# Realtime solar display (similar to that shown in SolarEdge app)
#
# Install [Power-Flow-Card-Plus](https://github.com/flixlix/power-flow-card-plus) using HACS
#
# See https://gist.github.com/Ashpork/f80fb0d3cb22356a12ed24734065061c for original
#
type: custom:power-flow-card-plus
title: Power Flow
entities:
home:
@thargy
thargy / cargo.toml
Last active August 17, 2021 10:57
Rust Localizable configuration system
[package]
name = "apocraphy"
version = "0.1.0"
edition = "2018"
readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
unic-langid = { version = "0.9", features = ["macros"] }
@thargy
thargy / Silk.Net.Input.cs
Last active August 10, 2021 19:42
Proposed of simplified Silk.Net.Input API.
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Reflection.Metadata.Ecma335;
using System.Threading;
@thargy
thargy / TestsBase.cs
Created July 23, 2020 00:29
Example base class and Context Logger for allowing XUnitContext to work easily with Microsoft.Extensions.Logging
// Licensed under the Apache License, Version 2.0 (the "License").
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Reactive;
using System.Reactive.Disposables;
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Logging;
@thargy
thargy / BuffersExtensions.cs
Last active November 2, 2018 17:47
Proposed implementation of new TryGetChunk extension method (see https://github.com/dotnet/corefx/issues/33098)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Buffers
{
using System.Runtime.CompilerServices;
public static class BuffersExtensions
{
@thargy
thargy / Input.cs
Created May 3, 2017 12:06
Alternate Input implementation
/// <summary>
/// Represents an input value to a batched program call.
/// </summary>
/// <typeparam name="T">The type of the value.</typeparam>
public struct Input<T>
{
private readonly object _value;
/// <summary>
/// Gets the value, if not <see cref="IsOutputValue"/>.
@thargy
thargy / Test Memory Mapped File.linq
Created September 23, 2016 07:40
Test Memory Mapped File (C#)
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Runtime.InteropServices.dll</Reference>
<Namespace>Microsoft.Win32.SafeHandles</Namespace>
<Namespace>System.IO.MemoryMappedFiles</Namespace>
<Namespace>System.Runtime.InteropServices</Namespace>
</Query>
void Main()
{