Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Atif Aziz atifaziz

I may be slow to respond.
Block or report user

Report or block atifaziz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
atifaziz /
Last active Feb 28, 2020
Demo that RyuJIT eliminates unreachable "typeof(T)==typeof(…)" branches in generic instantiations of a method

What's this?

Found an interesting [comment] in SqlDataReader's source code:

// this block of type specific shortcuts uses RyuJIT jit behaviours to achieve fast implementations of the primitive types
// RyuJIT will be able to determine at compilation time that the typeof(T)==typeof(<primitive>) options are constant
// and be able to remove all implementations which cannot be reached. this will eliminate non-specialized code for 
atifaziz / BuilderAsMonoid.csx
Last active Feb 21, 2020
A less ceremonial approach to “explicit endomorphism” presented by Mark Seemann in “Builder as a monoid”
View BuilderAsMonoid.csx
// This script is related the following blog entry by Mark Seeman titled,
// "Builder as a monoid":
// It demonstrates a simpler approach to avoid the ceremony of "explicit
// endomorphism" by using merely delegates. It does so by replacing
// "IEndomorphism<T>" with "Func<T, T>" and then using "+" in lieu of
// "AppendEndomorphism<T>" to achieve the same effect.
atifaziz / pack-priv.cmd
Created Jan 22, 2020
Windows batch for local/private NuGet packaging of projects
View pack-priv.cmd
@echo off
for /f "usebackq" %%f in (`PowerShell -C "([datetimeoffset](git ls -1 --pretty=%%cI)).ToUniversalTime().ToString('yyyyMMdd''T''HHmm')"`) do set COMMIT_TIMESTAMP=%%f
if not %ERRORLEVEL%==0 exit /b %ERRORLEVEL%
call "%~dp0pack.cmd" priv-%COMMIT_TIMESTAMP%
exit /b %ERRORLEVEL%
View Generic-Specific-HasFlag.cs
using System;
using System.IO;
using SharpLab.Runtime;
static class X
public static bool HasFlag(this FileAttributes self, FileAttributes flag) =>
(self & flag) == flag;
atifaziz /
Created Jun 14, 2019
Compiling C to WebAssembly using Clang/LLVM & WASI

Compiling C to WebAssembly using Clang/LLVM & WASI

These are my notes. See also “[Compiling C to WebAssembly using clang/LLVM and WASI][fda]” by [Frank Denis], which was my starting point.

Assume the following example program in a file called example.c:

#include <stdio.h>
atifaziz / Get-CrontabSchedule.ps1
Last active May 29, 2019
Crontab in PowerShell using NCrontab
View Get-CrontabSchedule.ps1
MIT License
Copyright (c) 2019 Atif Aziz
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
View System.Management.Automation.TypeAccelerators.csv
Accelerator Type
adsi System.DirectoryServices.DirectoryEntry
adsisearcher System.DirectoryServices.DirectorySearcher
Alias System.Management.Automation.AliasAttribute
AllowEmptyCollection System.Management.Automation.AllowEmptyCollectionAttribute
AllowEmptyString System.Management.Automation.AllowEmptyStringAttribute
AllowNull System.Management.Automation.AllowNullAttribute
ArgumentCompleter System.Management.Automation.ArgumentCompleterAttribute
array System.Array
bigint System.Numerics.BigInteger
atifaziz / MoreLinqStaticImports.snippet
Last active Apr 5, 2019
Visual Studio snippet for explicitly importing MoreLINQ extensions to avoid current & future potential for conflicts with System.Linq or similar libraries
View MoreLinqStaticImports.snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="">
<CodeSnippet Format="1.0.0">
atifaziz / Demo.csproj
Created Mar 26, 2019
Demo program for discussion of dotnet/cli#11016
View Demo.csproj
<Project Sdk="Microsoft.NET.Sdk">
atifaziz / dir
Created Mar 7, 2019
Recolor examples
View dir
You can’t perform that action at this time.