Skip to content

Instantly share code, notes, and snippets.

@dgrunwald
dgrunwald / async.cs
Created March 2, 2012 20:33
Async/Await support for .NET 4.0
// Copyright (c) 2012 Daniel Grunwald
//
// 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 all copies or
// substantial portions of the Software.
@masak
masak / explanation.md
Last active April 11, 2024 02:50
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@matthewmccullough
matthewmccullough / git-compressing-and-deltas.md
Created May 14, 2012 19:05
Git, Compression, and Deltas - An explanation

Git Compression of Blobs and Packfiles.

Many users of Git are curious about the lack of delta compression at the object (blob) level when commits are first written. This efficiency is saved until the pack file is written. Loose objects are written in compressed, but non-delta format at the time of each commit.

A simple run though of a commit sequence with only the smallest change to the image (in uncompressed TIFF format to amplify the observable behavior) aids the understanding of this deferred and different approach efficiency.

The command sequence:

Create the repo:

@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@mridgers
mridgers / pdbdump.c
Created June 21, 2012 21:19
Small tool to list and query symbols in PDB files.
//------------------------------------------------------------------------------
// pdbdump.c - dump symbols from .pdb and executable files (public domain).
// - to compile; cl.exe /Ox /Zi pdbdump.c
// -
// - Martin Ridgers, pdbdump 'at' fireproofgravy.co.uk
//------------------------------------------------------------------------------
#include <stdio.h>
#include <Windows.h>
#include <DbgHelp.h>
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@zclancy
zclancy / Common.cs
Created July 17, 2012 15:08
A simple console application for testing Lync Group Chat SDK. Command line parameters build the message, and specify the chat room. NDesk.Options is used for command line argument parsing.
using System;
using System.Configuration;
using System.Net;
using Microsoft.Rtc.Collaboration;
using Microsoft.Rtc.Collaboration.GroupChat;
using Microsoft.Rtc.Signaling;
namespace GroupChat
{
public static class Common
@davidfowl
davidfowl / gist:3703926
Created September 12, 2012 02:47
Performance Showdown
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
@davidfowl
davidfowl / gist:4015810
Created November 5, 2012 07:33
Detect ASP.NET shutdown
internal class ShutdownDetector : IRegisteredObject, IDisposable
{
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
private Timer _checkAppPoolTimer;
private static readonly TimeSpan _appPoolCheckInterval = TimeSpan.FromSeconds(10);
public CancellationToken Token
{
get { return _cts.Token; }
}
@chrisfraser
chrisfraser / .hgignore
Created February 1, 2013 09:02
A full list of entries for the .hgignore file when using VS2012.
# use glob syntax
syntax: glob
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc