Instantly share code, notes, and snippets.

# A hook script that checks the length of the commit message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
# htmltomd
# Downloads the HTML source from a list of URLs and converts it to Markdown.
# The source file must contain each URL to download from on a separate line.
# The actual conversion is done by the awesome API available at
outputDir=${2:-.} # Defaults to local dir
# cpustatus
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
View Import-PSSnapin.ps1
function Import-PSSnapin {
Adds a Windows PowerShell snap-in with the specified name to the current session.
This cmdlet will not throw an exception if the specified snap-in is already present in the session.
Helper function to safely add a Windows PowerShell snap-in with the specified name to the current session.
.Parameter Name
The name of the snap-in to import.
View Out-Diff.ps1
function Out-Diff {
Redirects a Universal DIFF encoded text from the pipeline to the host using colors to highlight the differences.
Helper function to highlight the differences in a Universal DIFF text using color coding.
.Parameter InputObject
The text to display as Universal DIFF.
View gist:1316023
public void CS_compiler_should_allow_named_arguments_in_lambdas()
// Given
var mock = new Mock<IProceduralPizzaStore>();
// When
m => m.OrderPizza(
name: "Quattro Formaggi",
View FileHeader.snippet.xml
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippet Format="1.0.0" xmlns="">
<Title>File Header</Title>
<Author>Enrico Campidoglio</Author>
<Description>Adds a StyleCop compliant file header comment with company and copyright information.</Description>
View gist:1266880
// <copyright file="«?FileBase»«?FileExtension»" company="«BlockAnchor»«Link(CompanyName)»«Caret»">
// Copyright (c) «Link(CompanyName)». All rights reserved.
// </copyright>