Skip to content

Instantly share code, notes, and snippets.

@guneysus
guneysus / memory_docs_samples.md
Created July 20, 2020 20:15 — forked from GrabYourPitchforks/memory_docs_samples.md
Memory<T> API documentation and samples

Memory<T> API documentation and samples

This document describes the APIs of Memory<T>, IMemoryOwner<T>, and MemoryManager<T> and their relationships to each other.

See also the Memory<T> usage guidelines document for background information.

First, a brief summary of the basic types

  • Memory<T> is the basic type that represents a contiguous buffer. This type is a struct, which means that developers cannot subclass it and override the implementation. The basic implementation of the type is aware of contigious memory buffers backed by T[] and System.String (in the case of ReadOnlyMemory<char>).
@guneysus
guneysus / profile.ps1
Created February 22, 2021 08:41 — forked from bradwilson/profile.ps1
Downloadable files for bradwilson.io/blog/prompt/powershell
######## POSH-GIT
# ... Import-Module for posh-git here ...
# Background colors
$GitPromptSettings.AfterStash.BackgroundColor = 0x3465A4
$GitPromptSettings.AfterStatus.BackgroundColor = 0x3465A4
$GitPromptSettings.BeforeIndex.BackgroundColor = 0x3465A4
$GitPromptSettings.BeforeStash.BackgroundColor = 0x3465A4
@guneysus
guneysus / disable_spectre.md
Created May 23, 2021 21:01 — forked from rizalp/disable_spectre.md
Disable Spectre/Meltdown Mitigation

In /etc/default/grub, modify:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off"

Then sudo update-grub

@guneysus
guneysus / .editorconfig
Created May 24, 2021 12:37 — forked from bryanknox/.editorconfig
.editorconfig for C# Visual Studio projects
# EditorConfig is awesome: https://EditorConfig.org
#
# More info about editorconfig for C# and .NET in Visual Studio see:
# https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
#
# Most of the .NET and C# rules below were taken from the
# Microsoft Roslyn team's editorconfig at:
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
# Top-most EditorConfig file.
@guneysus
guneysus / delete-with-select.cs
Created September 8, 2021 13:53 — forked from tombowers/delete-with-select.cs
Entity Framework - Update without Select
var id = 1;
using (var db = new entityContext())
{
// Select entity
var entity = db.dbset.FirstOrDefault(e => e.ID == id);
if (entity != null)
{
// Remove Entity
db.dbset.Remove(entity);
db.SaveChanges();
@guneysus
guneysus / renew-gpgkey.md
Created February 24, 2022 21:53 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@guneysus
guneysus / GitHub_PSModule.ps1
Created March 6, 2022 10:17 — forked from Badgerati/GitHub_PSModule.ps1
Example script for publishing a PowerShell module to the NuGet GitHub Package Registry
<# --
Register the GitHub Package Registry
-- #>
$username = '<github-username>'
$token = '<github-personal-token>'
$sourceName = 'GitHub'
$source = "https://nuget.pkg.github.com/$username/index.json"
# add the github package registry as a nuget source
@guneysus
guneysus / PE-COFF.md
Created November 3, 2022 19:26
PE/COFF Specification Addendum

PE/COFF Specification Addendum

Deterministic PE/COFF File

PE/COFF file is deterministic if it is produced by a tool that guarantees that the entire content of the file is based solely on documented inputs given to the tool (such as source files, resource files, compiler options, etc.) rather than ambient environment variables (such as the current time, the operating system, the bitness of the process running the tool, etc.). The content of the file can be reproduced exactly (bit for bit) given the same inputs.

The value of field TimeDateStamp in COFF File Header of a deterministic PE/COFF file does not indicate the date and time when the file was produced and should not be interpreted that way. Instead the value of the field is derived from a hash of the file content. The algorithm used to calculate this value is an implementation detail of the tool that produced the file.

Debug Directory

@guneysus
guneysus / RyuJIT-Tutorial.md
Created January 12, 2023 09:04 — forked from CarolEidt/RyuJIT-Tutorial.md
RyuJIT Tutorial

RyuJIT

The Open Source Just in Time Compiler for .NET

WHEN & WHERE

This tutorial was given at PLDI 2016. The content is available here.

ABSTRACT

This tutorial will present an introduction to RyuJIT (rē-yü-jit), an industry leading, high performance Just-in-Time compiler that supports the Microsoft .NET ecosystem. RyuJIT is also used to deliver world class performance on in house 1st party services like Office 365, Bing, and Exchange through innovative design and focus on business results. RyuJIT is shipping in the .NET 4.6 product and is now open source as part of CoreCLR.

An overview of the architecture of RyuJIT will be presented, including the internal representation (IR) and compilation phases with a focus on key design and imple