Skip to content

Instantly share code, notes, and snippets.

@bvanderveen
bvanderveen / doplot
Created February 9, 2015 00:31
GNUPlot from CSV (Originally from JSBSim cannonball example)
set terminal png
set output "plot.png"
set title "Cannon ball"
set key autotitle columnhead
set xlabel "Time"
set datafile separator ','
plot "output.csv" u 1:62 w lines
@bvanderveen
bvanderveen / gist:460e2aa6822755abe4ce
Last active August 29, 2015 14:22
How I complied libonion on OS X

How I compiled libonion on OS X

First, deps.

$ brew install libev

Edit CMakeLists.txt and set the following to false:

  • ONION_USE_PAM
  • ONION_USE_PTHREADS
public interface IApplication {
// either may throw exception
IAsyncResult BeginInvoke(IRequest request, AsyncCallback callback, object state);
IResponse EndInvoke(IAsyncResult result);
}
@bvanderveen
bvanderveen / TransformMiddleware.cs
Created December 19, 2010 05:36
An IApplication which transforms requests/responses to/from a wrapped IApplication
// this snippet assumes the IAsyncResult implementation provided here:
// http://msdn.microsoft.com/en-us/magazine/cc163467.aspx
using System;
using Owin;
namespace TransformMiddleware
{
// Defines a tranformation of an HTTP context.
public interface IHttpTransform
@bvanderveen
bvanderveen / Rx.cs
Created December 22, 2010 02:29
Examples of wrapping an APM operation using the Reactive Framework and the Task Parallel Library
using System;
using System.Disposables;
using System.IO;
using System.Linq;
using System.Threading;
namespace RxVsTplSamples
{
public static partial class Extensions
{
@bvanderveen
bvanderveen / OwinDraft2.cs
Created December 22, 2010 09:13
OWIN, take 2
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Owin
{
public struct OwinResponse
{
public string Status;
public IDictionary<string, IEnumerable<string>> Headers;
public IEnumerable<object> Body;
@bvanderveen
bvanderveen / Rx.cs
Created December 25, 2010 04:43
Examples of implementing an APM operation using the Reactive Framework and the Task Parallel Library
using System;
using System.Disposables;
using System.Linq;
using System.Threading;
namespace RxVsTplSamples
{
public class RxAsyncOperation<TArg, TResult>
{
Func<TArg, IObservable<TResult>> operation;
@bvanderveen
bvanderveen / ParserDriver.cs
Created January 13, 2011 23:46
Janky example of how to use JacksonH's C# port of a Java port of Ryan Dahl's http-parser
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ParserDriver
{
public class Parser
{
public string Method;
@bvanderveen
bvanderveen / Http.cs
Created February 19, 2011 21:52
Upcoming Kayak interface
using System;
using System.Collections.Generic;
namespace Kayak.Http
{
public class HttpRequestEventArgs : EventArgs
{
public IHttpServerRequest Request { get; internal set; }
public IHttpServerResponse Response { get; internal set; }
}
@bvanderveen
bvanderveen / Gate.Kayak.cs
Created March 21, 2011 09:57
Untested sketch of Kayak support in Gate.
using System;
using System.Collections.Generic;
using Kayak.Http;
// utterly, completely, maximally untested sketch of an OWIN-Kayak adapter.
namespace Gate.Kayak
{
using Application =
Action<
IDictionary<string, object>,