Skip to content

Instantly share code, notes, and snippets.

View panda728's full-sized avatar

HideyukiKitao panda728

View GitHub Profile
@panda728
panda728 / FactorioBOM.sql
Last active February 16, 2024 11:52
Factorioロケット打ち上げ必要資材表 SQLServer共通テーブル式(CTE)
begin tran t1
create table #recipe(
Id varchar(64) not null
,ParentID varchar(64)
,Amount real
,Yield real
,TimeSpan real
)
@panda728
panda728 / SJisExtentions.cs
Last active November 9, 2023 00:25
はしごだかの変換ツール髙->高
using System.Buffers;
using System.Text;
namespace Panda728.Extensions;
public static class ShiftJisExtension
{
// Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
readonly static Encoding _sjis = Encoding.GetEncoding("shift-jis");
const int ARRAY_POOL_LIMIT = 2048;
@panda728
panda728 / FilePipeReader.cs
Last active September 30, 2023 05:48
C# file reading, cutting out one line at a time as a ReadOnlySpan<byte>
using System.Buffers;
using System.IO.Pipelines;
namespace Panda728.Helper;
public sealed class FilePipeReader
{
public delegate void ReadTo(in ReadOnlySpan<byte> buffer);
readonly Pipe _pipe = new();
@panda728
panda728 / DataTableExtension.cs
Created June 14, 2023 11:34
C# Convert DataTable
using System.Data;
using System.Reflection;
using System.Runtime.CompilerServices;
public static class DataTableExtension
{
public static DataTable ToDataTable<T>(this IEnumerable<T> items) where T : new()
{
var properties = Cache<T>.Properties.AsSpan();
@panda728
panda728 / ServiceCollectionExtensions.cs
Last active October 19, 2022 03:57
Register a type with the specified interface from the types defined in the assembly in ConfigureServices of Host.CreateDefaultBuilder to DI
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
namespace ServiceCollectionExtensions;
public static class ServiceCollectionExtensions
{
/// <summary>Adds all types with the specifeid <typeparamref name="T"/> to the service with singleton.</summary>
public static IServiceCollection AddSingleton<T>(this IServiceCollection services, Assembly assembly, bool includeInternalTypes = false) where T : class
=> services.AddSpecifiedInterfaceFromAssembly(assembly, typeof(T), ServiceLifetime.Singleton, includeInternalTypes);
@panda728
panda728 / config.ini
Created June 14, 2021 21:34
M5Stack 設定ファイル実装例(config.ini) (検証環境 M5StackCore2 PlatformIO)(要M5GFX)
; config.ini
[ntp]
SERVER=ntp.jst.mfeed.ad.jp
TZ=JST-9
[wifi]
SSID=MySSID
PASS=MyPassword
#IP=0.0.0.0
#GATEWAY=0.0.0.0
@panda728
panda728 / main.cpp
Last active March 26, 2024 22:53
M5Stackでスクロールグラフ(M5GFX ver.)(Core2で動作確認)
#include <Arduino.h>
#include <M5GFX.h>
#include <vector>
#include <map>
#include <float.h>
#include <time.h>
static float room1[] = {21.6, 21.6, 21.6, 21.6, 21.6, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.4, 21.3, 21.3, 21.3, 21.3, 21.3, 21.3, 21.3, 21.3, 21.3, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.2, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.8, 20.8, 20.8, 20.8, 20.8, 20.8, 20.8, 20.8, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 20.9, 21.0, 21.0, 21.1, 21.1, 21.1, 21.2, 21.3, 21.4, 21.4, 21.5, 21.6, 21.7, 21.9, 22.0, 22.1, 2