Skip to content

Instantly share code, notes, and snippets.

View haf's full-sized avatar
💹
currently succeeding...

Henrik Feldt haf

💹
currently succeeding...
View GitHub Profile
@haf
haf / gist:1927153
Created February 27, 2012 21:14
Installing Graphite on Ubuntu 11.10 take 2
#number of seconds to use between flushing, default of 10, 1 for realtime
statsite_flush_interval=1
# 1 seconds * 1209600 datapoints = 2 week of 1 second granularity
# 10 seconds * 864000 datapoints = 2 months of 10-second granularity
# 60 seconds * 259200 datapoints = 6 months of 1-minute granularity
# 10 minutes * 262974 datapoints = ~3 years of 10-minute granularity
graphite_retentions='1:1209600,10:864000,60:259200,600:262974'
####################################
# BASIC REQUIREMENTS
@haf
haf / gist:2251439
Last active October 2, 2015 13:38
My .gitconfig
[user]
name = Henrik
email = henrik@haf.se
[alias]
ad = add . -A
co = commit
com = commit -m
st = status
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@haf
haf / gist:2429892
Created April 20, 2012 15:58
Disjoint Commands
[TestFixture(typeof(Customer), typeof(DocMeta), ... etc)]
class AllDisjointCmds<T> where T : AggregateRoot, new() {
AggregateRoot F(Command applyFirst, Command applySecond) {
var t = new T();
t.CallWith(applyFirst);
t.CallWith(applySecond);
return t;
}
@haf
haf / gist:2501894
Created April 26, 2012 18:48
MassTransit initialization
// Copyright 2012 Henrik Feldt
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
@haf
haf / gist:2640092
Created May 8, 2012 22:45
BackgroundFactoryMethod
/// <summary>
/// Register the component in a background thread on the thread pool.
/// Exceptions from factory method are thrown when the component is resolved.
/// </summary>
/// <typeparam name="TService">Type of service your component IS or IMPLEMENTS.</typeparam>
/// <param name="serviceRegistration">Previous registration that is not committed to method of instantiation of component.</param>
/// <param name="factory">The actual factory method for creating the service</param>
/// <param name="beforeInitialization">An optional callback that is run on the thread pool thread before initialization happens.
/// You can use this let the thread pool thread block and wait on e.g. a synchronization primitive.</param>
/// <returns>A component registration for Windsor which contains everything Windsor needs to know to use
@haf
haf / gist:2710007
Created May 16, 2012 12:34
Windsor custom lifestyle
[Explicit("For use on mailing list")]
public class WindsorNotDisposingTest
{
class MyDisposable
: IDisposable
{
bool _wasDisposed;
public bool WasDisposed
{
@haf
haf / gist:2783842
Created May 24, 2012 19:54
Passing contexts onwards
public interface IMessageTypeConverter
{
bool Contains(Type messageType);
bool TryConvert<T>(out T message)
where T : class;
IDictionary<Type, object> Enumerate();
}
@haf
haf / gist:2843680
Created May 31, 2012 14:19
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path =&gt; ssh_info[:private_key_path]
@haf
haf / gist:2999461
Created June 26, 2012 21:53
Minimal NLog.RabbitMQ configuration
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:haf="https://github.com/haf/NLog.RabbitMQ/raw/master/src/schemas/NLog.RabbitMQ.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
internalLogToConsole="true">
<extensions>
<add assembly="NLog.Targets.RabbitMQ" />
</extensions>
<targets async="true">
@haf
haf / Downloading the sample
Created June 26, 2012 21:57
Semantic Logging
git clone git://github.com/haf/semantic-logging.git
cd semantic-logging
git submodule update --init
./download.sh
vagrant up