Skip to content

Instantly share code, notes, and snippets.

View clemensv's full-sized avatar
🏠
Working from home

Clemens Vasters clemensv

🏠
Working from home
View GitHub Profile
@clemensv
clemensv / gist:9953010
Last active January 3, 2017 14:11
However often you call me, I'm only going to flush every 200msec from the first flush call
Task flushingTask = null;
public override Task FlushAsync(CancellationToken cancellationToken)
{
Interlocked.CompareExchange(
ref flushingTask,
Task.Delay(200, cancellationToken).ContinueWith(
async (t) =>
{
await write.FlushAsync(cancellationToken);
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Tahoma, Geneva, sans-serif;
}
div {
display: inline;
.svc file
--------------
<%@ ServiceHost Language="C#" Debug="true" Service="MyService.Service1" %>
using System.ServiceModel;
namespace MyService
{
[ServiceContract]
public class Service1
@clemensv
clemensv / afdlist.csv
Last active September 2, 2017 12:14
Liste erstellt aus Resultat der Twittersuche ""#traudichdeutschland OR #afdwaehlen OR #grueneversenken OR #fdpversenken OR #cduversenken OR #spdversenken -#noafd"
We can't make this file beautiful and searchable because it's too large.
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
866335089273315328,2017-05-21 16:49:15 +0000,2017-09-01 16:30:39 +0000,447,3121,1,85,17,007michiko,Tired Joe,false,false,,"RT @Beatrix_vStorch: Warum fragt #wahlomat nicht nach Islam,4. Griechenlandpaket,Familiennachzug,GEZ,Bargeldabschaffung,aber nach Bafög, Nutztieren u Impfpficht?",,
619170508,2012-06-26 15:20:12 +0000,2017-09-01 19:16:18 +0000,5337,2965,8,394,384,01_charly01,charly 01,false,false,"Der Gipfel des Wahnsinns ist es,auf Veränderungen zu hoffen,ohne etwas zu verändern","RT @Junge_Freiheit: AfD-Spitzenkandidatin Weidel fordert, Bundeskanzlerin Merkel wegen Rechtsverstößen vor Gericht zu stellen. https://t.co/0yFXB6UAwx",,
259638173,2011-03-02 08:39:54 +0000,2017-09-02 10:22:41 +0000,4104,3699,3,21,35,0930uhr,Paul Müller,false,false,,RT @timm_ti: @Ralf_Stegner https://t.co/oBseoibV0w,,
2817931146,2014-09-18 21:24:53 +0000,2017-09-02 01:33:39 +0000,18690,30572,11,37
@clemensv
clemensv / sbfifo.md
Last active November 20, 2017 07:16

FIFO in Service Bus

The explantion below is taken out of the context of an internal email exchange, and while we already have product documentation about this topic, this also seemed worth sharing. The email context stated that the customer asked for string First-In-First-Out (FIFO) assurances, but without any specifics about their scenario. Scenarios for hard FIFO requirements are not very common, I might add:

"It’s usually helpful to ask the customer back on exactly why they want they want true in-order delivery, i.e. FIFO, and then look at the use-case.

Service Bus has a specific feature for helping with order assurances, namely Sessions.

Order preservation requires a grouping criterion for the sequence you need ordered, and it needs a mechanism that ensures that messages are delivered to a receiver in that order. That includes not only that the sequence sorting is observed, but that also that no messages go missing b

@clemensv
clemensv / DynamicSemaphoreSlim.cs
Created October 21, 2017 08:32
DynamicSemaphoreSlim
//---------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
//
// MIT license.
//---------------------------------------------------------------------------------
namespace ServiceBusPerfSample
{
using System;
using System.Threading;
@clemensv
clemensv / sqlfiltersandrules.cs
Created February 21, 2013 12:35
I should talk about this more. SQL filters and rules on Service Bus Topics subscriptions. SQL action syntax http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.sqlruleaction.sqlexpression.aspx
namespace SqlFiltersAndRules
{
using System;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
class Program
{
static void Main(string[] args)
{
@clemensv
clemensv / gist:6554605
Last active April 6, 2018 03:16
using Task.WhenAny to drive a pump of multiple async operations in the same context (such as an I/O pump)
/*
Example use (from an email I sent)
I’m using WhenAny to either register for a callback on any of the pending operations and to use
the IO thread that comes up with their respective completion or to execute handling of completed
work on the current thread (‘borrowing’ the IO thread).
So if I read from a socket and from a queue, first both ops hang. Queue read completes and I get
called back on an IO thread which continues the await. I process that completion in the loop.
Meanwhile the socket read completes. That IO thread pops up and just registers the fact that it’s
{
"openapi": "3.0.2",
"info": {
"title": "AMQP Management",
"version": "1.0"
},
"components": {
"schemas": {
"discovery-document": {
"type": "object",
{
"openapi": "3.0.2",
"info": {
"title": "AMQP Management",
"version": "1.0"
},
"components": {
"schemas": {
"discovery-document": {
"type": "object",