Skip to content

Instantly share code, notes, and snippets.

View KostyaEsmukov's full-sized avatar
🔥
Maybe we just wanna watch the world burn

Kostya Esmukov KostyaEsmukov

🔥
Maybe we just wanna watch the world burn
View GitHub Profile

Lab: Mikrotiks + StrongSwan site-to-site IPsec

  • Goal: create a playground for experimenting with different IPsec settings between 3 sites: 2 Mikrotiks and 1 StrongSwan node.

  • Requirements:

    • GNS3
    • VirtualBox (VMware or nested kvm would be even better)

Lab: Active Directory as LDAP for Linux

  • Goal: Create a minimal working setup where a Linux machine retrieves users from Active Directory via LDAP.
  • Requirements: Vagrant, VirtualBox.

Setup

Put all of the attached files somewhere and switch to that directory.

Lab: Kafka and Network Partitions

  • Questions:
    • Does a Kafka cluster of 3 nodes survive a rolling restart of the nodes without losing a single message?
  • Requirements: Vagrant, VirtualBox

Setup

Lab: Docker Swarm and Network Partitions

  • Questions:
    • How does Docker Swarm behave in the different parts of a cluster during a network partition? Will it recover by itself when the partition is gone?
    • What happens to a single-instance service when that node is getting partitioned off?
  • Requirements: Vagrant, VirtualBox

Lab: Consul and Network Partitions

  • Questions:
    • How does Consul behave in the different parts of a cluster during a network partition? Will it recover by itself when the partition is gone?
    • Would Consul change the Raft Leader if the current leader won't be able to communicate with some nodes while some other node will?
    • How does Consul perform in a lossy network?
  • Requirements: Vagrant, VirtualBox
@KostyaEsmukov
KostyaEsmukov / Vagrantfile
Last active June 5, 2019 22:28
Consul Network Partitioning lab
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "512"
end
config.vm.provision "docker" do |d|
consul_config = %(
{
@KostyaEsmukov
KostyaEsmukov / 1 ev-stress-fail.py
Last active May 30, 2018 11:18
Safe Eventlet queue across multiple threads
"""
First attempt: doesn't work.
Output:
,,,,,,,,,,,,,,,,,,,,,,,,,,,<snip>
"""
import sys
from threading import Thread
from time import sleep

Keybase proof

I hereby claim:

  • I am kostyaesmukov on github.
  • I am kostyaesmukov (https://keybase.io/kostyaesmukov) on keybase.
  • I have a public key ASClWOseyvvMsrBslvH4oRiafYGPLbKqZxmMVCvE1yb4qQo

To claim this, I am signing this object:

IEEE 754 double binary representation with Python

>>> import struct
>>> pd = lambda x: format(struct.unpack('!Q', struct.pack('!d', x))[0], '064b')
>>> pd(180.00000000000003)    
# sign (1 bit) | exponent (11 bit) | fraction (52 bit)
#\/         \/
'0100000001100110100000000000000000000000000000000000000000000001'
>>> pd(180)

'0100000001100110100000000000000000000000000000000000000000000000'

@KostyaEsmukov
KostyaEsmukov / node.js
Last active April 11, 2024 06:30
go vs py3 asyncio vs node vs socat - tcp piping performance
iperf -s -p 5201 -V
iperf -c ::1 -p 5202 -t 10 -d --format Mbits -V
iperf3 -s
iperf3 -c ::1 -p 5202 -i 1 -t 10
socat tcp6-listen:5202 tcp6-connect:'[::1]:5201'
https://github.com/BlueDragonX/go-proxy-example
./go-proxy-example -listen='[::1]:5202' -backend='[::1]:5201'