Skip to content

Instantly share code, notes, and snippets.

@tmarkovski
tmarkovski / deserialize-net-benchmark.md
Last active December 19, 2021 12:59
Deserialization Benchmark for .NET
BenchmarkDotNet=v0.13.1, OS=macOS Monterey 12.1 (21C52) [Darwin 21.2.0]
Intel Core i9-9880H CPU 2.30GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.100
  [Host]     : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Method Records Mean Error StdDev Gen 0 Gen 1 Allocated
Protobuf_Json 1 4.814 μs 0.0502 μs 0.0445 μs 0.6180 - 5 KB
Newtonsoft_Linq 1 5.030 μs 0.0461 μs 0.0431 μs 0.8545 0.0153 7 KB
@tmarkovski
tmarkovski / ProtobufCosmosSerializer.cs
Last active December 18, 2021 23:46
Protobuf serializer for Azure Cosmos DB
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text;
using System.Text.Json;
using Google.Protobuf;
using Google.Protobuf.Reflection;
using Microsoft.Azure.Cosmos;
public class ProtobufCosmosSerializer : CosmosSerializer
@tmarkovski
tmarkovski / Cargo.toml
Created November 21, 2021 02:25 — forked from mcastorina/Cargo.toml
Clap and rustyline tab completion integration
[package]
name = "tmp"
version = "0.1.0"
authors = ["Miccah Castorina <m.castorina93@gmail.com>"]
edition = "2018"
[dependencies]
clap-v3 = { version = "3.0.0-beta.1", features = ["yaml"] }
rustyline = "6.2.0"
serde_yaml = "0.8"
Verifying my Blockstack ID is secured with the address 1EBUBYXiyTsUUZZu4mTA7N76Us6uCyrCpL https://explorer.blockstack.org/address/1EBUBYXiyTsUUZZu4mTA7N76Us6uCyrCpL
@tmarkovski
tmarkovski / Program.cs
Last active April 16, 2024 06:55
Generate elliptic curve SECP256K1 key pair using Bouncy Castle for .NET
using System;
using System.Linq;
using Org.BouncyCastle.Asn1.X9;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
namespace Program
{