Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
gregoryyoung / gist:5909115
Created July 2, 2013 13:03
Interesting :) 10 seconds between them
greg@ouroboros:~/src/EventStore.wiki$ git commit -a
[master 569272f] fix spacing
1 file changed, 1 insertion(+)
greg@ouroboros:~/src/EventStore.wiki$ git push
error: The requested URL returned error: 403 while accessing https://github.com/EventStore/EventStore.wiki.git/info/refs
fatal: HTTP request failed
greg@ouroboros:~/src/EventStore.wiki$ git push
To https://github.com/EventStore/EventStore.wiki.git
bb35789..569272f master -> master
greg@ouroboros:~/src/EventStore.wiki$
@gregoryyoung
gregoryyoung / gist:5916838
Created July 3, 2013 10:13
from httplistener.cs
else {
throw new ArgumentException(SR.GetString(SR.net_listener_scheme), "uriPrefix");
}
bool inSquareBrakets = false;
int j = i;
while (j<uriprefix.length &&="" uriprefix[j]!="/" (uriprefix[j]!=":" ||="" insquarebrakets))="" {="" if="" (uriprefix[j]="='[')" (insquarebrakets)="" j="i;" break;="" }="" insquarebrakets="true;" (insquarebrakets="" uriprefix[j]="=']')" j++;="" (i="=j)" throw="" new="" argumentexception(sr.getstring(sr.net_listener_host),="" "uriprefix");="" (uriprefix[uriprefix.length-1]!="/" )="" argumentexception(sr.getstring(sr.net_listener_slash),="" registeredprefix="uriPrefix[j]==':'" ?="" string.copy(uriprefix)="" :="" uriprefix.substring(0,="" j)="" +="" ":80"="" ":443")="" uriprefix.substring(j);="" fixed="" (char*="" pchar="registeredPrefix)" i="0;" while="" (pchar[i]!=":" pchar[i]="(char)CaseInsensitiveAscii.AsciiToLower[(byte)pChar[i]];" i++;="" globallog.print("httplistener#"="" validati
@gregoryyoung
gregoryyoung / gist:5917423
Last active December 19, 2015 07:18
Proof that httplistener does not use http.sys kernel caching
From HttpListener source code
http://www.dotnetframework.org/default.aspx/DotNET/DotNET/8@0/untmp/whidbey/REDBITS/ndp/fx/src/Net/System/Net/HttpListenerResponse@cs/2/HttpListenerResponse@cs
line 525
UnsafeNclNativeMethods.HttpApi.HttpSendHttpResponse(
HttpListenerContext.RequestQueueHandle,
HttpListenerRequest.RequestId,
(uint)flags,
greg@ouroboros:~/Downloads$ cat shit.json
[
{
"eventId": "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4",
"eventType": "event-type",
"data": {
"a": "1"
}
}
]
@gregoryyoung
gregoryyoung / gist:6023616
Created July 17, 2013 19:22
code poetry
class shitbird {
public void Poem() {
Roses.Are().Red()
.Violets.Are().Blue()
.DynamicProxies.Are().Complicated()
.And.So.Is(x = > this.Too);
}
public void Too() {
Console.Writeline("I became insane, with long intervals of horrible sanity.");
public void deactivating_an_inventory_item() {
Given(() => {
yield return new InvntoryItemCreated(12);
})
When(new DeactivateInventoryItem(12, "foo"));
Expect(new InventoryItemDeactivated(12, "foo"));
}
public void deactivating_a_deactivated_inventory_item() {
Given(() => {
29 try {
30
31 switch (Integer.parseInt(rel)) {
32 case 1:
33 case 2:
34 case 3:
35 case 4:
36 case 5:
37 case 6:
38 case 7:
@gregoryyoung
gregoryyoung / gist:7372958
Last active December 27, 2015 18:49
not sure
class Program
{
const int KILO = 1024;
const long MEGA = 1024 * KILO;
const long GIGA = 1024 * MEGA;
static void Main(string[] args)
{
var size = 7 * KILO;
var count = 1000;
@gregoryyoung
gregoryyoung / gist:7373286
Created November 8, 2013 16:05
updated code much more reasonable now
class Program
{
const int KILO = 1024;
const long MEGA = 1024 * KILO;
const long GIGA = 1024 * MEGA;
static void Main(string[] args)
{
var size = 7 * KILO;
var count = 1000;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace crap
{
using System;
using System.Collections.Generic;
using System.Data;