Skip to content

Instantly share code, notes, and snippets.

View WhiteBlackGoose's full-sized avatar
🦆
Quack

WhiteBlackGoose

🦆
Quack
View GitHub Profile
@nat-418
nat-418 / nix-home-manager-neovim-setup.md
Last active April 23, 2024 19:43
Manage Neovim plugins (and more!) with Nix and Home Manager

Manage Neovim plugins (and more!) with Nix and Home Manager

Highly extensible software like Emacs, Vim, and Neovim tend to grow their own package managers. A software developer, for example, might want to install editor plugins that hook into a particular programming language's linter or language server. The programmer's text editor is therefore extended to support managing additional software to extend the text editor. If this loop continues for too long, the programmer's editor becomes more delicate and complex. The remedy for this problem is to manage software using dedicated tools apart

@EgorBo
EgorBo / Dynamic PGO in .NET 6.0.md
Last active January 25, 2024 15:15
Dynamic PGO in .NET 6.0.md

Dynamic PGO in .NET 6.0

Dynamic PGO (Profile-guided optimization) is a JIT-compiler optimization technique that allows JIT to collect additional information about surroundings (aka profile) in tier0 codegen in order to rely on it later during promotion from tier0 to tier1 for hot methods to make them even more efficient.

What exactly PGO can optimize for us?

  1. Profile-driving inlining - inliner relies on PGO data and can be very aggressive for hot paths and care less about cold ones, see dotnet/runtime#52708 and dotnet/runtime#55478. A good example where it has visible effects is this StringBuilder benchmark:

  2. Guarded devirtualization - most monomorphic virtual/interface calls can be devirtualized using PGO data, e.g.:

void DisposeMe(IDisposable d)
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.IO.Pipes;
using System.Linq;
using System.Management;
using System.Net;
@ZacharyPatten
ZacharyPatten / VisualStudioSettings.md
Last active August 25, 2023 17:03
Just a reference of Visual Studio settings I use...

These are some notes about settings I like to use when I code in Visual Studio. They are completely optional.

  • Automatic brace completion = false
  • Dark Theme Tools -> Options -> Environment -> General
  • Disable Semicolon Bullshit Tools -> Options -> Text Editor -> C# -> IntelliSense
    • Automatically complete statement on semicolon = false
  • Control Click Tools -> Options -> Text Editor -> General
    • Enable mouse click to perform Go to Definition = false
  • Shift Key Overrides Tools -> Options -> Environment -> Keyboard
@WhiteBlackGoose
WhiteBlackGoose / GenericTensor.md
Last active March 16, 2023 05:53
This is a short article about how I managed to implement basic generic tensor library

Generic tensor library in C# in a week

Hello!

For this article we take Tensor as a N-dimensional array whose last two axes might be interpreted as Matrix and/or the last axis might be interpreted as Vector. For TLDR the result is here.

What do we want?

  1. Tensors (N-dimensional storage)
  2. Implementation of methods and functions for working with tensors as with data storages
@ZacharyPatten
ZacharyPatten / AttributesMethodOverrides.cs
Created July 23, 2020 17:20
An example of using attributes to override default method implementations.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using static Syntax;
static class Program
{
static void Main()
@huytd
huytd / todo.vim
Created June 14, 2020 07:34
A Todo list syntax in Vim, with an actual checkbox
" Vim syntax file
" Language: Todo
" Maintainer: Huy Tran
" Latest Revision: 14 June 2020
if exists("b:current_syntax")
finish
endif
" Custom conceal
@swlaschin
swlaschin / FsCsInterop.md
Last active April 7, 2024 20:33
F# to C# interop tips

Tips on exposing F# to C#

Api and Methods

I suggest that you create one or more Api.fs files to expose F# code in a C# friendly way.

In this file:

  • Define functions with PascalCase names. They will appear to C# as static methods.
  • Functions should use tuple-style declarations (like C#) rather than F#-style params with spaces.
@chrisdone
chrisdone / Printf.idr
Last active December 8, 2023 00:02
Type-safe dependently-typed printf in Idris
module Printf
%default total
-- Formatting AST.
data Format
= FInt Format
| FString Format
| FOther Char Format
| FEnd
@nepsilon
nepsilon / how-to-ssh-agent.md
Last active December 7, 2023 20:21
Remember passphrases with ssh-agent — First published in fullweb.io issue #31

How to use ssh-agent to cache your SSH credentials?

Contributed by Fabien Loudet, Linux SysAdmin at Rosetta Stone

Tired of always having to enter your SSH key passphrase when logging in to remote machines? Here comes ssh-agent. Enter the passphrase once and it will keep it in memory for you

Using ssh-agent in your shell session: