Skip to content

Instantly share code, notes, and snippets.

View mempko's full-sized avatar

Maxim Khailo mempko

View GitHub Profile
@mempko
mempko / gist:eb176bed65f9b60a2aaaea0cb59eadd0
Created February 7, 2017 21:22
my perl6 nginx log grammar
grammar Nginx
{
rule TOP {^ .* '"' <host> <cmd> <path> <protocol> '"' <response> .* $}
token host { \S+ }
regex path { '/' <path-elem>? <path>?}
token path-elem { \S+ }
regex protocol { 'HTTP/1.1'}
token response { \d+ }
proto token cmd {*}
FROM rakudo-star
RUN apt update && apt install -y \
librdkafka++1 \
libssl-dev
RUN zef update
RUN zef install PKafka HTTP::Client
....
@mempko
mempko / kafka_example.p6
Created December 30, 2015 19:43
Example usage of Perl 6 Kafka library in progress.
use v6;
use lib 'lib/kafka';
use Kafka;
sub MAIN ()
{
my $consumer = Kafka::Consumer.new( topic=>"test", brokers=>"192.168.0.5");
$consumer.messages.tap(-> $msg