Skip to content

Instantly share code, notes, and snippets.

@atifaziz
atifaziz / Get-CrontabSchedule.ps1
Last active May 29, 2019 14:48
Crontab in PowerShell using NCrontab
<#
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
@atifaziz
atifaziz / System.Management.Automation.TypeAccelerators.csv
Last active December 22, 2020 03:54
PowerShell Type Accelerators
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
atifaziz / MoreLinqStaticImports.snippet
Last active April 5, 2019 16:16
Visual Studio snippet for explicitly importing MoreLINQ extensions to avoid current & future potential for conflicts with System.Linq or similar libraries
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Keywords>
<Keyword>linq</Keyword>
<Keyword>extensions</Keyword>
</Keywords>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@atifaziz
atifaziz / Demo.csproj
Created March 26, 2019 06:59
Demo program for discussion of dotnet/cli#11016
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>
@atifaziz
atifaziz / dir
Created March 7, 2019 08:31
Recolor examples
yellow=<DIR>.+$
magenta=<(JUNCTION|SYMLINKD)>.+$
yellow=(?<=<(JUNCTION|SYMLINKD)>.+)\[.+\]$
cyan=(?<=\x20)(?i:[^\x20]+\.(cmd|bat|exe|com|ps1|wsh|wsf|vbs))$
gray=\(([0-9][0-9]?|[0-9][0-9,'.][0-9]*)\)
#region Copyright (c) 2018 Atif Aziz. All rights reserved.
//
// 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 furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@atifaziz
atifaziz / csharp-query-expression-pattern.md
Created September 10, 2018 06:49
C# Query Expression Pattern (§7.15.3, C# Language Specification, Version 3.0)

C# Query Expression Pattern

§7.15.3 The query expression pattern, C# Language Specification, Version 3.0

Copyright © Microsoft Corporation 1999-2007. All Rights Reserved.

The Query expression pattern establishes a pattern of methods that

@atifaziz
atifaziz / Box.cs
Last active December 16, 2021 19:49
Generic Box in C# for explicit boxing of value types
#region The MIT License (MIT)
//
// Copyright (c) 2018 Atif Aziz. All rights reserved.
//
// 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 furnished to do so,
// subject to the following conditions:
@atifaziz
atifaziz / MoreLinqAwaitCompletionDemo.linq
Created May 25, 2018 10:55
Demo of MoreLINQ's AwaitCompletion
<Query Kind="Expression">
<NuGetReference Prerelease="true">morelinq</NuGetReference>
<Namespace>MoreLinq</Namespace>
<Namespace>MoreLinq.Experimental</Namespace>
</Query>
Enumerable
.Range(1, 5)
.Select(x => TimeSpan.FromSeconds(x))
.RandomSubset(5)
@atifaziz
atifaziz / .gitconfig
Last active May 5, 2023 06:15
My Git aliases
[alias]
aliases = config --get-regexp ^alias\\.
last = log -1 HEAD
ls = log --decorate --pretty=format:%Cgreen%h%Cred%d%Creset\\ %s\\ [%an]
ll = log --pretty=fuller
st = status
diffc = diff --cached
ci = commit
cia = commit --amend
mff = merge --ff-only