Skip to content

Instantly share code, notes, and snippets.


Daniel Cazzulino kzu

View GitHub Profile
View FnvHash.cs
/// <summary>
/// A hash combiner that is implemented with the Fowler/Noll/Vo algorithm (FNV-1a). This is a mutable struct for performance reasons.
/// Taken from
/// </summary>
public struct FnvHash
/// <summary>
/// The starting point of the FNV hash.
/// </summary>
public const ulong Offset = 14695981039346656037;
attilah / X.Y.Z.Sources.csproj
Last active Apr 15, 2021
X.Y.Z.Sources nuget package
View X.Y.Z.Sources.csproj
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />


Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which to perform analysis can be challenging. For simple tasks, creating a Compilation populated with SyntaxTrees, MetadataReferences and a handful of options may suffice. However, if there are multiple projects involved in the analysis, it is more complicated because multiple Compilations need to be created with references between them.

To simplify the construction process. Roslyn provides the Workspace API, which can be used to model solutions, projects and documents. The Workspace API performs all of the heavy lifting needed to parse SyntaxTrees from source code, load MetadataReferences, and construct Compilations and add references between them.

AArnott / StrongNameTokenFromPublicKey.cs
Last active Jul 14, 2017
Demonstrates calculating a strong name token from a public key
View StrongNameTokenFromPublicKey.cs
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace ConsoleApp43
static class Program
static void Main(string[] args)
kzu / notnull.snippet
Last active Mar 25, 2020
ArgumentNullException C# Code Snippet
View notnull.snippet
<?xml version="1.0" encoding="utf-8" ?>
Template for a null check for a parameter.
Press notnull[TAB][TAB] to get it.
Copy to Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets\notnull.snippet
Restart VS
<CodeSnippets xmlns="">
<CodeSnippet Format="1.0.0">
View Keep Column Sorted in Google
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
View RemoveGitTags.txt
Replace with your own usename and email:
git config --global "Username"
git config --global ""
These next two commands tell Git to use your Windows credentials to store your origin password.
git config --global credential.helper wincred
git config --global credential.helper store
View manually-add-trust-cert-to-rubygems.bat
ruby -e "open(`gem which rubygems`.sub(/\.rb\s*\z/, '/ssl_certs/AddTrustExternalCARoot-2048.pem'), 'wb').write %(-----BEGIN CERTIFICATE-----\nMIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU\nMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs\nIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290\nMB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux\nFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h\nbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v\ndDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt\nH7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9\nuMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX\nmk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX\na0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN\nE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0\nWicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD\nVR0PBAQDAgEGMA8GA1UdEwEB
kzu / fact.snippet
Last active Jul 5, 2016
Code snippet for creating BDD-style xUnit tests
View fact.snippet
<?xml version="1.0" encoding="utf-8" ?>
<!-- Download to %userprofile%\Documents\Visual Studio [2010|2012|2013|vNext]\Code Snippets\Visual C#\My Code Snippets -->
Template for xunit test methods
Press fact[tab][tab] to get it.
<CodeSnippets xmlns="">
<CodeSnippet Format="1.0.0">
<Title>XUnit test</Title>
kzu / Class1.cs
Last active Aug 28, 2018
Generates class files from a text file and makes intellisense work
View Class1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynamicIntellisense
public class Class1