Skip to content

Instantly share code, notes, and snippets.

class Program
{
static void Main()
{
const int iterations = 100;
const int repetitions = 100000;
long directDispatchStatic = 0, directDispatchInstance = 0, virtualDispatchBase = 0,
virtualDispatchOverride = 0, interfaceDispatch = 0;
var stopwatch = new Stopwatch();
[<TestFixture>]
type ``Recursion Exploration`` () =
//...
[<Test>]
member test.``Should not apply TCO.`` () =
CannotTCO |> should beGreaterThan maxStack
[<Test>]
Session.asp
<%
Response.ContentType = "application/json"
If Request.QueryString("command") = "enumerate" Then
Response.Write("[")
Response.Write("{""Key"": ""key1"", ""Value"": ""value1"", ""DataType"": ""datatype1""},")
open System
open System.IO
open System.Text.RegularExpressions
open System.Linq
let RegExGroups pattern (group1:string) (group2:string) source =
Regex.Matches(source, pattern, RegexOptions.IgnoreCase).Cast<Match>()
|> Seq.map (fun x -> (x.Groups.Item(group1).Value, x.Groups.Item(group2).Value))
let IncludeRegEx = "<!--\\s*#include\\s+(?<type>\w*)\\s*=\\s*\"(?<url>.*)\"\\s*-->"
Dr. Alan Kay on the Meaning of “Object-Oriented Programming”
http://www.purl.org/stefan_ram/pub/doc_kay_oop_en
Date: Wed, 23 Jul 2003 09:33:31 -0800
To: Stefan Ram [removed for privacy]
From: Alan Kay [removed for privacy]
Subject: Re: Clarification of "object-oriented"
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
Content-Length: 4965
Lines: 117
/////////////////////////////////////////////////////////////////////////////////
//
// SQLCrackCl
//
// This will perform a dictionary attack against the
// upper-cased hash for a password. Once this
// has been discovered try all case variant to work
// out the case sensitive password.
//
// This code was written by David Litchfield to
@mikeobrien
mikeobrien / SqlHashedPassword.cs
Created June 10, 2011 02:59
Managed implementation of SQL Server pwdencrypt function
public class SqlHashedPassword
{
private static readonly Random Random = new Random();
private static readonly SHA1CryptoServiceProvider Hash = new SHA1CryptoServiceProvider();
private static readonly byte[] Header = new byte[] {1, 0};
private readonly byte[] _hash;
private readonly byte[] _salt;
private SqlHashedPassword(byte[] salt, byte[] hash)
{
public static T ThrowIfNull<T>(this T target) where T : class
{
if (target == null) throw new NullReferenceException(
string.Format("Object reference of type '{0}' not set to an instance of an object.", typeof(T).FullName));
return target;
}
public class AuthenticationBehavior : IActionBehavior
{
private readonly IUrlRegistry _registry;
private readonly CurrentRequest _request;
private readonly IOutputWriter _writer;
private readonly IActionBehavior _actionBehavior;
private readonly ISecureSession _secureSession;
public AuthenticationBehavior(IUrlRegistry registry, CurrentRequest request, IOutputWriter writer, IActionBehavior actionBehavior, ISecureSession secureSession)
{
[DllImport("user32.dll")]
static extern int GetWindowThreadProcessId(IntPtr windowHandle, IntPtr processId);
public void Close()
{
var threadId = GetWindowThreadProcessId(Browser.hWnd, IntPtr.Zero);
Process.GetProcessesByName("iexplore").First(x => x.Threads.Cast<ProcessThread>().Any(y => y.Id == threadId)).Kill();
}