Skip to content

Instantly share code, notes, and snippets.

View kant2002's full-sized avatar

Andrii Kurdiumov kant2002

View GitHub Profile
@kant2002
kant2002 / UnmanagedType.cs
Created March 23, 2020 22:00
Unmanaged constraint
namespace System.Runtime.InteropServices
{
public class UnmanagedType { }
}
@kant2002
kant2002 / CoreRT.csproj
Last active March 23, 2020 22:19
Disable standard runtime in CoreRT application
<PropertyGroup>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<RuntimeMetadataVersion>v4.0.30319</RuntimeMetadataVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<IlcSystemModule>SeeSharpSnake</IlcSystemModule>
</PropertyGroup>
<Target Name="CustomizeReferences" BeforeTargets="BeforeCompile" AfterTargets="FindReferenceAssembliesForReferences">
@kant2002
kant2002 / CoreRT.csproj
Created March 23, 2020 22:17
Linker parameters for UEFI application using CoreRT
<ItemGroup>
<LinkerArg Include="/subsystem:EFI_APPLICATION /entry:EfiMain" />
</ItemGroup>
@kant2002
kant2002 / SeeSharpSnake.csproj
Last active March 23, 2020 22:22
Package UEFI application in VHDX
<Target Name="GenerateVirtuaDisk" AfterTargets="Publish">
<PropertyGroup>
<VHD>$(MSBuildProjectDirectory)\$(NativeOutputPath)seesharpsnake.vhdx</VHD>
<CreatePartitionCommand>
create vdisk file=$(VHD) maximum=40
select vdisk file=$(VHD)
attach vdisk
convert gpt
create partition efi
format quick fs=fat32 label="System"
@kant2002
kant2002 / setup-vm.ps1
Created March 23, 2020 22:24
Create Virtual Machine for UEFI CoreRT application
New-VM -Name SeeSharpSnake -MemoryStartupBytes 32MB -Generation 2 -VHDPath "bin\x64\Release\netcoreapp3.1\win-x64\native\seesharpsnake.vhdx"
Set-VMFirmware -VMName SeeSharpSnake -EnableSecureBoot Off
Set-VM -Name SeeSharpSnake -AutomaticCheckpointsEnabled $false -CheckpointType Disabled
@kant2002
kant2002 / augmentations.d.ts
Last active July 31, 2020 15:41
jQueryEventextension
/// <reference types="jquery" />
declare interface JQuery {
on(events: ':passageinit', handler: (this: JQuery, t: x, ...args: any[]) => any): this;
}
@kant2002
kant2002 / entrypoint.cs
Created February 5, 2021 12:16
Generated code by ILC
using Internal.Runtime.CompilerHelpers;
// ....
int main(int argc, char** argv)
{
StartupCodeHelpers.InitializeCommandLineArgsW(argc, argv);
String[] arguments = StartupCodeHelpers.GetMainMethodArguments();
int exitCode = __managed_Main(arguments);
StartupCodeHelpers.SetLatchedExitCode(exitCode);
@kant2002
kant2002 / commandlinesuppor.cs
Created February 5, 2021 12:20
Code for Runtime library to support command line parameters
namespace Internal.Runtime.CompilerHelpers
{
internal partial class StartupCodeHelpers
{
internal static unsafe void InitializeCommandLineArgsW(
int argc, char** argv)
{
}
internal static unsafe void InitializeCommandLineArgs(
using System;
Console.WriteLine("Hello UEFI!");
@kant2002
kant2002 / Benchmarks.txt
Last active April 2, 2021 05:24
NativeAOT and databases
// * Summary *
BenchmarkDotNet=v0.12.1.20210402-develop, OS=Windows 10.0.19042.867 (20H2/October2020Update)
Intel Core i7-6700HQ CPU 2.60GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET SDK=5.0.201
[Host] : .NET 5.0.4 (5.0.421.11614), X64 RyuJIT
ShortRun : .NET 6.0.0-preview.4.21175.3, X64 AOT
| ORM | Method | Return | Mean | StdDev | Error | Gen 0 | Gen 1 | Gen 2 | Allocated |