Skip to content

Instantly share code, notes, and snippets.

@markuskont
markuskont / arch-linux-install
Last active January 9, 2018 11:26 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
package main
import (
"fmt"
"log"
"strings"
"time"
"sync"
"sync/atomic"
"os"
$provision_script = <<SCRIPT
apt-get update
GOLANG="go1.8.3.linux-amd64.tar.gz"
cd /vagrant
[[ -f $GOLANG ]] || wget -q -4 https://storage.googleapis.com/golang/$GOLANG
tar -zxvf $GOLANG -C /usr/local/ > /dev/null 2>&1
# clear all messages in kafka topics by temorarily changing retention time in (in ms)
# doing this with kafka-topics.sh may be deprecated in future
MS=1000
IP=127.0.0.1
for topic in `./kafka-topics.sh --list --zookeeper $IP:2181` ; do ./kafka-topics.sh --zookeeper $IP:2181 --alter --topic $topic --config retention.ms=$MS ; done
MS=259200000
...
# show consumer groups
./kafka-consumer-groups.sh --zookeeper $IP:2181 --list
@markuskont
markuskont / Dockerfile
Last active November 6, 2017 12:22
Simple node-js script for sending avro-encoded netflow into kafka
FROM node:6.11.5-slim
WORKDIR /opt/app
ARG port=9995
ARG topic=test-topic-1
ARG zookeeper=zoo1
RUN apt-get update && \
apt-get install -y python build-essential && \
rm -rf /var/lib/apt/lists/*
@markuskont
markuskont / gist:d90cdaf5d76ba0038f244284197fe501
Created August 30, 2017 08:12 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@markuskont
markuskont / snoopy.rb
Created September 6, 2017 11:23
rulebase files for liblognorm
version=2
include=/opt/liblognorm-rulebase/stdtypes.rb
type=@ssh:%[
{"type": "ipv4", "name":"src_ip"},
{"type": "whitespace"},
{"type": "number", "name":"src_port"},
{"type": "whitespace"},
{"type": "ipv4", "name":"dst_ip"},
FROM ubuntu:16.04
RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | tee -a /etc/apt/sources.list && \
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 && \
gpg -a --export E084DAB9 | apt-key add -
RUN apt-get update && apt-get install -y sudo gdebi-core wget libxslt1-dev libxkbcommon-dev libxcb-xkb-dev libxslt1-dev libgstreamer-plugins-base0.10-dev libgl1-mesa-glx libgl1-mesa-dri
RUN apt-get install -y r-base r-base-dev
RUN apt-get build-dep -y r-cran-rgl
@markuskont
markuskont / hyperLogLog.go
Last active September 26, 2017 11:26
Simple implementation of hyperloglog cardinality estimation algorithm. Bare minimum for counting unique words in log files, but relies on Golang 1.9 for counting leading zeros. Only implements dense estimation with Add() and Count().
package main
import(
"fmt"
"flag"
"errors"
"math/bits"
"os"
"log"
"bufio"
package main
import (
"bufio"
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"