Skip to content

Instantly share code, notes, and snippets.

View kant2002's full-sized avatar

Andrii Kurdiumov kant2002

View GitHub Profile
@kant2002
kant2002 / README.md
Created November 24, 2014 07:05
ADB PowerShell tools

Display threads usage which take more then 10 seconds.

AdbThreadProc 11324 | where 'UserTime' -gt 10  | foreach { $_.ThreadName + "," + $_.UserTime }
@kant2002
kant2002 / readme.md
Last active August 29, 2015 14:19
Задачи по Javascript

Задачи по Javascript

Для всех задач сделайте один репозиторий. При решении каждой задачи сохраняйте решение каждой задачи в отдельный файл. Файл должен называться task.js. Например для задачи номер 1, файл будет task1.js

Задача 1

В файле создайте массив из чисел, примерно 5-10 чисел. Посчитайте сумму числе в массиве. Распечатайте сперва все исходные данные, потом распечатайте сумму чисел в массиве.

Задача 2

@kant2002
kant2002 / benchmarking.md
Created May 7, 2019 11:46
HTML to Plan char
Method A Mean Error StdDev
HtmlToPlainCharArray 10.20 ns 0.3174 ns 0.5035 ns
HtmlToPlainCharArrayPointer 10.72 ns 0.3073 ns 0.2724 ns
HtmlToPlainCharArrayCopyPointer 18.59 ns 0.4337 ns 0.6220 ns
HtmlToPlainCharArrayIndexOf 31.96 ns 0.7656 ns 1.2791 ns
HtmlToPlainStringBuilder 28.08 ns 0.6584 ns 1.4313 ns
HtmlToPlainStringBuilderIndexOf 36.27 ns 0.8272 ns 0.8494 ns
HtmlToPlainStringJoinIndexOf 132.66 ns 2.8314 ns 5.3180 ns
Using "RestoreTask" task from assembly "C:\Program Files\dotnet\sdk\3.1.101\NuGet.Build.Tasks.dll".
Task "RestoreTask"
(in) RestoreGraphItems Count '6'
(in) RestoreDisableParallel 'False'
(in) RestoreNoCache 'False'
(in) RestoreIgnoreFailedSources 'False'
(in) RestoreRecursive 'True'
(in) RestoreForce 'False'
(in) HideWarningsAndErrors 'False'
(in) RestoreForceEvaluate 'False'
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"/>
</packageSources>
</configuration>
@kant2002
kant2002 / EfiRuntimeHost.cs
Last active March 23, 2020 21:26
UEFI in CoreRT
public unsafe static class EfiRuntimeHost
{
public static EFI_SYSTEM_TABLE* SystemTable { get; private set; }
public static void Initialize(EFI_SYSTEM_TABLE* systemTable)
{
SystemTable = systemTable;
}
}
@kant2002
kant2002 / Console.cs
Created March 23, 2020 21:33
Trivial Port of Console operations
public unsafe static ConsoleColor ForegroundColor
{
set
{
s_consoleAttribute = (ushort)value;
uint color = s_consoleAttribute;
EfiRuntimeHost.SystemTable->ConOut->SetAttribute(EfiRuntimeHost.SystemTable->ConOut, color);
}
}
@kant2002
kant2002 / EFI_SIMPLE_TEXT_INPUT_PROTOCOL.cs
Created March 23, 2020 21:39
How to wrap UEFI functions
[StructLayout(LayoutKind.Sequential)]
public unsafe readonly struct EFI_SIMPLE_TEXT_INPUT_PROTOCOL
{
private readonly IntPtr _reset;
private readonly IntPtr _readKeyStroke;
public readonly IntPtr WaitForKey;
public void Reset(void* handle, bool ExtendedVerification)
{
@kant2002
kant2002 / EfiApplication.cs
Created March 23, 2020 21:44
CoreRT UEFI startup code
public unsafe static class EfiApplication
{
[System.Runtime.RuntimeExport("EfiMain")]
unsafe static long EfiMain(IntPtr imageHandle, EFI_SYSTEM_TABLE* systemTable)
{
EfiRuntimeHost.Initialize(systemTable);
Console.Clear();
Game.Main();
@kant2002
kant2002 / RawCalliHelper.cs
Created March 23, 2020 21:58
CoreRT Calli helper
[System.Runtime.InteropServices.McgIntrinsicsAttribute]
internal class RawCalliHelper
{
public static unsafe ulong StdCall<T, U, W, X>(IntPtr pfn, T* arg1, U* arg2, W* arg3, X* arg4) where T : unmanaged where U : unmanaged where W : unmanaged where X : unmanaged
{
// This will be filled in by an IL transform
return 0;
}
public static unsafe ulong StdCall<T, U, W, X>(IntPtr pfn, T arg1, U* arg2, W* arg3, X* arg4) where T : struct where U : unmanaged where W : unmanaged where X : unmanaged
{