This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Sync(); | |
Async().Wait(); | |
} | |
const int len = 1024 * 16; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Proxy() | |
{ | |
var tcpListener = new TcpListener(IPAddress.Loopback, 9000); | |
tcpListener.Start(); | |
var buffer = new byte[1024]; | |
while (true) | |
{ | |
var incomingConnection = tcpListener.AcceptTcpClient(); | |
var tcpClient = new TcpClient(); | |
tcpClient.Connect(IPAddress.Loopback, 9999); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet test -xml test-timings.xml | |
[xml]$tests = Get-Content test-timings.xml | |
$tests.assemblies.assembly.collection.test | | |
sort @{e={$_.time -as [double]} } -descending | | |
select time, name -first 10 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <time.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <malloc.h> | |
#include <sys/uio.h> | |
#include <sys/file.h> | |
#include <unistd.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <Windows.h> | |
#define FILE_SIZE (1024 * 1024 * 1024L) | |
#define CHUNK_SIZE (16 * 1024) | |
void simulate_journal_writes(HANDLE file, char* desc, int use_fsync) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task WatchDocuments(TcpClient client) | |
{ | |
try | |
{ | |
using (client) | |
using (var stream = client.GetStream()) | |
using (var reader = new StreamReader(stream)) | |
using (var writer = new StreamWriter(stream)) | |
{ | |
var idToWatch = await reader.ReadLineAsync(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task WatchDocuments(TcpClient client) | |
{ | |
try | |
{ | |
using (client) | |
using (var stream = client.GetStream()) | |
using (var reader = new StreamReader(stream)) | |
using (var writer = new StreamWriter(stream)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class TimeoutManager | |
{ | |
private static TaskCompletionSource<object> _nextTimeout = new TaskCompletionSource<object>(); | |
private static Timer _timer; | |
static TimeoutManager() | |
{ | |
_timer = new Timer(TimerCallback, null, 1000, 1000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var orders = store.Subscriptions.Open<Order>(ordersSubscription, new SubscriptionConnectionOptions()); | |
orders.Subscribe(order => | |
{ | |
GenerateInvoice(order); | |
}); | |
orders.Subscribe(order => | |
{ | |
if(order.State == OrderState.Invalid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
private static TcpListener _listener; | |
private static readonly byte[] ShortMessageBuffer = Encoding.UTF8.GetBytes("Hello\r\n"); | |
private static readonly byte[] LongMessageBuffer = Encoding.UTF8.GetBytes("Be my friend, please?\r\n"); | |
static readonly byte[] HeartbeatBuffer = Encoding.UTF8.GetBytes("\r\n"); | |
static void Main() | |
{ | |
_listener = new TcpListener(IPAddress.Loopback, 9090); |