Skip to content

Instantly share code, notes, and snippets.

import { request } from "https://gist.githubusercontent.com/Davilink/a417b30c28b750f5309786fe4fb83674/raw/d220ec3ce746c60556e72d5846ec0774a82a3faa/tcp-rpc.ts";
type TemperatureC = number;
type FanPercentage = number;
type PowerWatt = number;
type MemoryTempC = number;
interface MinerStatDetailDto {
connection: {
connected: boolean;
@Davilink
Davilink / FailBackEnumConverter.cs
Last active September 4, 2020 19:22 — forked from gubenkoved/TolerantEnumConverter.cs
FailBack JSON.NET enum converter
// Inspired by: https://gist.github.com/gubenkoved/999eb73e227b7063a67a50401578c3a7
public class FailBackStringEnumConverter : JsonConverter
{
[ThreadStatic]
private static Dictionary<Type, Dictionary<string, object>>? _fromValueMap; // string representation to Enum value map
[ThreadStatic]
private static Dictionary<Type, Dictionary<object, string>>? _toValueMap; // Enum value to string map
public string UnknownValue { get; set; } = "Unknown";