This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
BenchmarkRunner.Run<MemoryCopyBenchmark>(); | |
[MemoryDiagnoser] | |
public class MemoryCopyBenchmark | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
using System.IO; | |
using System.Windows.Media.Imaging; | |
BenchmarkRunner.Run<WpfBitmapSourceBenchmark>(); | |
public class WpfBitmapSourceBenchmark | |
{ | |
[Params(@"img100x100.bmp", @"img1000x1000.bmp")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
set BAT_PATH=%~f0 | |
powershell -NoProfile -Command "& {$cscode=[regex]::Split([IO.File]::ReadAllText($env:BAT_PATH,[Text.Encoding]::UTF8),':EndBatch')[2]; Add-Type -TypeDefinition $cscode -Language CSharp; [CSBatch.Program]::Main($Args);}" %* | |
endlocal | |
exit /b | |
:EndBatch | |
using System; | |
using System.IO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text; | |
File.WriteAllText("_p2_16b.pgm", CreateP2_16b()); | |
File.WriteAllText("_p3_16b_gray.ppm", CreateP3_Gray16b()); | |
File.WriteAllText("_p3_16b_red.ppm", CreateP3_Red16b()); | |
File.WriteAllText("_p3_16b_green_blue.ppm", CreateP3_GreenBlue16b()); | |
File.WriteAllBytes("_p5_16b.pgm", CreateP5_16b()); | |
File.WriteAllBytes("_p6_16b_red.pgm", CreateP6_Red16b()); | |
File.WriteAllBytes("_p6_16b_green_blue.pgm", CreateP6_GreenBlue16b()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [Memory-Mapped Files and Overlaid Structs](https://blog.stephencleary.com/2023/09/memory-mapped-files-overlaid-structs.html) | |
// [Padding for Overlaid Structs](https://blog.stephencleary.com/2023/10/padding-for-overlaid-structs.html) | |
using System; | |
using System.Buffers.Binary; | |
using System.IO; | |
using System.IO.MemoryMappedFiles; | |
using System.Runtime.CompilerServices; | |
using FileStream file = new( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 図形を検出します。 | |
from pathlib import Path | |
import numpy as np | |
import cv2 | |
IMAGE_WINDOW_TITLE = 'preview' | |
#------------------------------------------------------------------- | |
file_path = Path(__file__).parent / 'shapes.png' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/ufcpp-live/UfcppLiveAgenda/issues/73#issuecomment-1595764176 | |
using System.Globalization; | |
using System.Runtime.CompilerServices; | |
Console.WriteLine(DateTime.Now); | |
// source generator で強制的に足せば… | |
static class Initialier | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp1; | |
public interface IBelonging<T> | |
where T : IBelonging<T> | |
{ | |
static abstract Owner<T> Create(); | |
} | |
public readonly record struct Owner<T> : IDisposable | |
where T : IBelonging<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine(new Dialog().GetResult()); | |
var message = new Confirm().GetResult().IsYes ? "Deleted" : "Canceled"; | |
Console.WriteLine(message); | |
struct Dialog | |
{ | |
public YesNo<Dialog> GetResult() => YesNo<Dialog>.Yes; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://remix-yh.net/1324/ | |
using System.Reflection; | |
var plugin = GetExternalPlugin("ClassLibrary1.dll"); | |
Console.WriteLine(plugin?.GetMessage() ?? "null"); | |
static IPlugin? GetExternalPlugin(string filename) | |
{ | |
static Type? GetTargetImplementedType<T>(Assembly assembly) | |
{ |
NewerOlder