Skip to content

Instantly share code, notes, and snippets.

Mark Rendle markrendle

Block or report user

Report or block markrendle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@markrendle
markrendle / explanation.md
Last active Sep 23, 2019
Why I was previously not a fan of Apache Kafka
View explanation.md

Update, September 2016

OK, you can pretty much ignore what I wrote below this update, because it doesn't really apply anymore.

I wrote this over a year ago, and at the time I had spent a couple of weeks trying to get Kafka 0.8 working with .NET and then Node.js with much frustration and very little success. I was rather angry. It keeps getting linked, though, and just popped up on Hacker News, so here's sort of an update, although I haven't used Kafka at all this year so I don't really have any new information.

In the end, we managed to get things working with a Node.js client, although we continued to have problems, both with our code and with managing a Kafka/Zookeeper cluster generally. What made it worse was that I did not then, and do not now, believe that Kafka was the correct solution for that particular problem at that particular company. What they were trying to achieve could have been done more simply with any number of other messaging systems, with a subscriber reading messages off and writing

@markrendle
markrendle / Program.cs
Created Jul 24, 2019
IndentedTextWriter Async Fail
View Program.cs
using System.CodeDom.Compiler;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace IndentFail
{
class Program
{
static async Task Main(string[] args)
@markrendle
markrendle / Gulpfile.js
Created Jun 25, 2015
Gulp to copy js plus minified version
View Gulpfile.js
var gulp = require('gulp'),
hint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename');
gulp.task('lint', function() {
return gulp.src(['Scripts/**/*.js'])
.pipe(hint());
});
@markrendle
markrendle / Client.cs
Last active Jun 7, 2019
.NET Core 3.0 gRPC code
View Client.cs
using Greet;
using Grpc.Core;
namespace ClientApp
{
class Program
{
static async Task Main(string[] args)
{
var channel = new Channel("localhost:50051",
@markrendle
markrendle / ChannelsQueue.cs
Last active Apr 29, 2019
Better implementation of ChannelsQueue
View ChannelsQueue.cs
public class ChannelsQueue : IJobQueue<Action>
{
private ChannelWriter<Action> _writer;
public ChannelsQueue()
{
var channel = Channel.CreateUnbounded<Action>();
var reader = channel.Reader;
_writer = channel.Writer;
View Squares.cs
public static class Squares
{
public static int Square(int i) => i * i;
public static int SumOfSquares(int i) => Enumerable.Range(1, i).Select(Square).Sum();
}
@markrendle
markrendle / IXmlSerializable.cs
Last active Mar 2, 2018
SXmlSerializable shape for fixing Jon Skeet's problems in C# 9.0
View IXmlSerializable.cs
/*
The IXmlSerializable interface assumes the mutability of the type the implements it.
Now we have readonly structs, that's not a valid assumption. Ideally, there'd be a static
method that returned a new instance of the type, but you can't have static methods on
interfaces, because reasons.
*/
[Deprecated]
public interface IXmlSerializable
View PS1.sh
export PS1='\n[\e[0;32m\u@\h\e[m \e[1;33m\w\e[m\e[0;31m$(__git_ps1 " (%s)")\e[m]\n\$ '
@markrendle
markrendle / MITEA.license
Created Mar 30, 2015
The "MIT Except Apple" License
View MITEA.license
The MIT-except-Apple License (MIT-EA)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person (except
anybody associated with Apple Inc.) obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@markrendle
markrendle / README.md
Last active Aug 5, 2017
Vagrantfile to run Kafka in boot2docker
View README.md

Kafka in Docker in Vagrant

I'm using this Vagrantfile to run Kafka on a Windows 8.1 laptop for development purposes.

It runs the ultra-lightweight boot2docker Linux, then uses Vagrant's Docker provisioning support to spin up ZooKeeper and Kafka.

The fun bits to work out were:

  • You need to forward the ports on both Vagrant (lines 13 & 14) and Docker (the -p flag), so you can access the instance from Windows using localhost:9092
You can’t perform that action at this time.