Skip to content

Instantly share code, notes, and snippets.

View AnthonyMastrean's full-sized avatar
🏡
Working remotely

Anthony Mastrean AnthonyMastrean

🏡
Working remotely
View GitHub Profile
// http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking
using System;
using System.Threading;
// Thanks to Eric Gunnerson for recommending this be a struct rather
// than a class - avoids a heap allocation.
// Thanks to Change Gillespie and Jocelyn Coulmance for pointing out
// the bugs that then crept in when I changed it to use struct...
// Thanks to John Sands for providing the necessary incentive to make
@AnthonyMastrean
AnthonyMastrean / Latch.cs
Created September 6, 2012 14:55
Latch object and some related behavior
namespace System
{
public class Latch
{
public static explicit operator Latch(bool isSet)
{
return new Latch(isSet);
}
public static implicit operator bool(Latch latch)
@AnthonyMastrean
AnthonyMastrean / Connect-VM.ps1
Last active December 21, 2015 03:49
Somehow, the Hyper-V PowerShell module does not contain a connection function.
#requires -Version 3.0
function Connect-VM {
[CmdletBinding(DefaultParameterSetName='name')]
param(
[Parameter(ParameterSetName='name')]
[Alias('cn')]
[System.String[]]$ComputerName=$env:COMPUTERNAME,
[Parameter(Position=0,
Mandatory,ValueFromPipelineByPropertyName,
@AnthonyMastrean
AnthonyMastrean / Behaviors_Functionality.cs
Created September 9, 2013 20:52
A comparison of unit mask converters
[Behaviors]
public class UnitMaskConverterBehaviors
{
It should_convert_0_to_A = () => _converter.Convert(0).ShouldEqual('A');
It should_convert_1_to_B = () => _converter.Convert(1).ShouldEqual('B');
It should_convert_2_to_C = () => _converter.Convert(2).ShouldEqual('C');
It should_convert_4_to_D = () => _converter.Convert(4).ShouldEqual('D');
It should_convert_8_to_E = () => _converter.Convert(8).ShouldEqual('E');
It should_convert_16_to_F = () => _converter.Convert(16).ShouldEqual('F');
It should_convert_32_to_G = () => _converter.Convert(32).ShouldEqual('G');
@AnthonyMastrean
AnthonyMastrean / Get-TfsCodeClosure.ps1
Created February 1, 2014 18:47
TFS repository statistics
function Get-TfsCodeClosure {
<#
.SYNOPSIS
Report the relative degree of closure of a codebase.
.DESCRIPTION
Are you concerned that your codebase is a festering one? Want
proof? Then run this function at the solution root and watch as
it reports the number of check-ins per C# code file. This
function only works against TFS source control (and the working
@AnthonyMastrean
AnthonyMastrean / textfiles.markdown
Last active August 29, 2015 14:21
Large text files
@AnthonyMastrean
AnthonyMastrean / feed.rss
Created May 24, 2017 16:04
american-rhetoric-podcast-top-100-speeches
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file generated by Dropcaster 0.0.7 -->
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>American Rhetoric - Top 100 Speeches</title>
<link>http://www.americanrhetoric.com/</link>
<description>Rationalize rhetoric and it speaks to your mind, personify her and she speaks to your soul.</description>
<itunes:summary>Rationalize rhetoric and it speaks to your mind, personify her and she speaks to your soul.</itunes:summary>
<generator>Dropcaster 0.0.7</generator>
<item>