Skip to content

Instantly share code, notes, and snippets.

View itn3000's full-sized avatar
πŸ€”
πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”

Yusuke Ito itn3000

πŸ€”
πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”
View GitHub Profile
@itn3000
itn3000 / github-actions-release.yml
Last active April 6, 2022 07:00
github actions release event type sandbox
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
release:
types:
- published
@itn3000
itn3000 / NuGetVersionParseTest.cs
Last active April 1, 2022 15:02
nuget semver2 parse test
// dotnet add package NuGet.Versioning --version 6.1.0
using System;
using System.Reflection;
using NuGet.Versioning;
namespace nugetclienttest
{
class Program
{
static void OutputVersion(NuGetVersion v)
@itn3000
itn3000 / GetConfigurationChangedNotification.cs
Last active March 29, 2022 16:41
sandbox for getting notification of IConfiguration changes
// dotnet add package Microsoft.Extensions.Hosting;
// dotnet add package System.Reactive;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Configuration;
using System.Reactive.Concurrency;
using System.Reactive.Subjects;
using System.Reactive.Linq;
using System.CommandLine;
using System.CommandLine.Binding;
var opt1 = new Option<string>(new string[]{ "--opt1", "-o1" }, "this is option1");
var opt2 = new Option<int>(new string[]{ "--opt2", "-o2" }, "this is option2");
var rootcmd = new RootCommand("this is root");
rootcmd.Add(opt1);
rootcmd.Add(opt2);
rootcmd.AddCommand(CreateCommand1());
@itn3000
itn3000 / versionreadfrompe.rs
Last active March 24, 2022 02:32
read exe version by rust with pelite( https://github.com/CasualX/pelite )
// this works with linux
use std::fs;
use pelite::pe64::Pe;
use pelite::pe32::Pe as Pe32;
use pelite::Error as PeErrors;
use memmap2::Mmap;
fn output_ver_info(p: &std::path::Path) -> Result<(), anyhow::Error> {
{
// let f = std::fs::File::open(p)?;
@itn3000
itn3000 / FasterLogV2PreTest.cs
Created March 8, 2022 17:54
FasterLog v2pre sandbox
using FASTER.core;
using var x = Devices.CreateLogDevice("xlog");
var flsetting = new FasterLogSettings("hoge");
using var fl = new FasterLog(new FasterLogSettings("hoge")
// {
// FastCommitMode = true,
// LogCommitDir = "xlog-commits"
// }
);
@itn3000
itn3000 / RateLimitApiTest.cs
Last active April 27, 2022 04:32
memo about System.Threading.RateLimiting(Japanese)
// See https://aka.ms/new-console-template for more information
using System.Threading.RateLimiting;
using System.Diagnostics;
await Concurrency();
// await TokenBucket();
async Task Concurrency()
{
await using var limiter = new ConcurrencyLimiter(new ConcurrencyLimiterOptions(
@itn3000
itn3000 / SerializeErrorInSystemJson.cs
Last active February 16, 2022 07:22
Serialize error in System.Text.Json if ctor has "in" or "ref" keyword
// TargetFramework: net6.0
// this can be avoided if there is ctor with no "ref" or "in".
using System.Text.Json;
int z = 0;
var c1 = new C1(ref z);
try
{
JsonSerializer.Serialize(c1);
}
@itn3000
itn3000 / FasterLogExporter.cs
Last active February 16, 2022 06:31
opentelemetry-dotnet FasterLog exporter(test implementation)
using OpenTelemetry.Trace;
using OpenTelemetry.Resources;
using OpenTelemetry;
using FASTER.core;
using System.Text.Json;
using System.Buffers;
using System.Diagnostics;
using OpenTelemetry.Metrics;
namespace opentelemetryfltest
@itn3000
itn3000 / MessagePipeUnixDomainSocketTest.cs
Last active September 21, 2022 11:37
MessagePipe Unix domain socket example
// you can run this code in Linux,macOS,Windows(10 April 2018 or later)
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Threading;
using System.Threading.Tasks;
using System;
using MessagePipe;
public class RemotePublisher : BackgroundService
{
IDistributedPublisher<int, int> _Publisher;