Skip to content

Instantly share code, notes, and snippets.

The Heartbleed bug is a serious internet security issue that's even worse than it sounds.

Imagine that when everyone wakes up tomorrow, we all realize something fishy on our front doors. Right beside the door lock, the key to the door has been taped to the door! Anyone who walks by could use it to come and go as they please. Suppose we all also realize that our keys have been taped to our doors like this for two whole years now.

If criminals happened to notice the keys were so handy during those two years, then they've had the run of the place for that whole time. Regardless of whether criminals knew about the keys during those two years, they definitely know about it this week.

This week, all the affected websites are in a mad scramble to remove the keys from their own front doors. At the same time, criminals are in a mad scramble to walk up to every door, make a copy of the key, and put back the original so nobody knows they were there.

Responsible organizations who understand the problem are bo

public class SamplesAssembly : TestAssembly
{
public SamplesAssembly()
{
Apply<Categories.CustomConvention>();
Apply<Explicit.CustomConvention>();
Apply<Inclusive.CustomConvention>();
Apply<IoC.CustomConvention>();
Apply<LowCeremony.CustomConvention>();
Apply<NUnitStyle.CustomConvention>();
public class NoSeriouslyDudeMarshalByRefObject : MarshalByRefObject, IDisposable
{
public override sealed object InitializeLifetimeService()
{
return null; //Prevent the object from being ruined after 6 or so minutes.
}
public void Dispose()
{
RemotingServices.Disconnect(this); //Avoid the memory leak otherwise introduced above.
@plioi
plioi / Retry.cs
Last active August 29, 2015 14:17
Fixie Convention - Retry on SQL Timeouts
public class IntegrationTestConvention : Convention
{
public IntegrationTestConvention()
{
Classes
.NameEndsWith("Tests");
Methods
.Where(method => method.IsVoid() || method.IsAsync());
public class MessageBus
{
public void Send(IMessage message)
{
//Sends a single message.
}
public void SendAll(List<IMessage> messages)
{
foreach (var message in messages)
public interface IEnumerable<out T> : IEnumerable
{
IEnumerator<T> GetEnumerator()
}
public void SendAll(IEnumerable<IMessage> messages)
{
foreach (var message in messages)
Send(message);
}
public interface IMessage { }
public class RemoveOrderLineItem : IMessage { }
public class MessageBus
{
public void Send(IMessage message)
{
//Send the message.
}
//When you write:
public enum Role
{
System,
Manager,
Employee,
HumanResources
}
//...the compiler assumes you wrote:
Role manager = (Role)(1);
Role bogus = (Role)(-1);
Console.WriteLine(manager);
Console.WriteLine(bogus);
//Output:
// Manager
// -1