Skip to content

Instantly share code, notes, and snippets.

View ForNeVeR's full-sized avatar
🦑

Friedrich von Never ForNeVeR

🦑
View GitHub Profile
@akarpov89
akarpov89 / InterpolatedParsing.cs
Created October 1, 2021 14:58
Interpolated parsing technique
using System.Runtime.CompilerServices;
using static ParsingExtensions;
string input = "Name: Andrew; Age: 31";
string? name = null;
int age = 0;
if (input.TryParse($"Name: {Placeholder(ref name)}; Age: {Placeholder(ref age)}"))
{
@rafaelldi
rafaelldi / WinDbg and LLDB commands.md
Last active July 2, 2024 23:10
WinDbg and LLDB commands

Starting

Command WinDbg LLDB
Start windbg {executable} [{args}] lldb {executable} [--args]
Attach windbg -p {pid} lldb --attach-pid {pid}

Symbols and modules

Command WinDbg LLDB
(Re)load symbols lb {module-name} target symbols add {symbol-file-path}
@anatoly-spb
anatoly-spb / pretty_thread_logger.h
Last active April 26, 2023 06:58
Pretty Thread Logger
/*
* Pretty thread logger
*
* Copyright (C) 2020 Anatoly Shirokov.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@EgorBo
EgorBo / SSE4.1 and AVX2 in .NET Core 2.1.cs
Last active November 18, 2019 19:09
SSE4.1 and AVX2 in .NET Core 2.1.cs
using System;
using System.Linq;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace ConsoleApp29
{
public class Program

Assert On Steroids

I find it useful to have assert statements in my code. It has several benefits:

  • Self documents code expectations
  • Establishes boundary checks between component
  • Helps to pinpoint problems by failing fast, especially when you just started dealing with a new library
  • Here is a good summary on using assertions.

In a dream world all this can be addressed by sophisticated type system but we all know it’s not going to happen any time soon.

@maestrow
maestrow / copy-to-readme.md
Last active March 24, 2018 04:36
Start Scripting with F# and Paket on Windows (Использование Paket в скриптах F# на Windows, автоматизация)
diff --git a/nativelib/src/main/resources/unwind.c b/nativelib/src/main/resources/unwind.c
index b87e730..f66f836 100644
--- a/nativelib/src/main/resources/unwind.c
+++ b/nativelib/src/main/resources/unwind.c
@@ -1,19 +1,20 @@
-#include <libunwind.h>
+//#include <libunwind.h>
+#include <stddef.h>
int scalanative_unwind_get_context(void *context) {
@Newlifer
Newlifer / fix.sh
Created February 1, 2017 07:37
fix.sh
git filter-branch --env-filter 'if [ "$GIT_AUTHOR_EMAIL" = "" ]; then GIT_AUTHOR_EMAIL=; GIT_AUTHOR_NAME=""; GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL; GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; fi' -- --all
@mlaily
mlaily / NativeMembers.cs
Last active November 28, 2023 06:05
Find which process have a file opened using the Restart Manager API
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
// ReSharper disable InconsistentNaming
namespace RestartManager
@davidfowl
davidfowl / Example1.cs
Last active September 2, 2024 12:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)