Skip to content

Instantly share code, notes, and snippets.

View FirefoxMetzger's full-sized avatar

Sebastian Wallkötter FirefoxMetzger

View GitHub Profile
#include <cassert>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
template <typename I>
void sub_divide_rotate(I first, I last) {
auto mid = std::distance(first, last) / 2;
@FirefoxMetzger
FirefoxMetzger / test.py
Created July 2, 2017 10:02
ZMQ inproc connect then bind
import zmq
context = zmq.Context()
address = "inproc://test"
#subscriber -- connecting first
sub = context.socket(zmq.SUB)
sub.connect(address)
sub.setsockopt(zmq.SUBSCRIBE, "test")
poller = zmq.Poller()
@FirefoxMetzger
FirefoxMetzger / test.py
Last active July 2, 2017 10:42
PUB + connect - then - SUB + bind
import zmq
context = zmq.Context()
address = "inproc://test"
#publisher
pub = context.socket(zmq.PUB)
pub.connect(address)
#subscriber
@FirefoxMetzger
FirefoxMetzger / test.py
Last active July 2, 2017 10:42
PUB + bind - then - SUB + connect
import zmq
context = zmq.Context()
address = "inproc://test"
#publisher
pub = context.socket(zmq.PUB)
pub.bind(address)
#subscriber
@FirefoxMetzger
FirefoxMetzger / test.py
Last active July 2, 2017 10:42
SUB + connect - then - PUB + bind
import zmq
context = zmq.Context()
address = "inproc://test"
#subscriber
sub = context.socket(zmq.SUB)
sub.connect(address)
sub.setsockopt(zmq.SUBSCRIBE, "test")
poller = zmq.Poller()
@FirefoxMetzger
FirefoxMetzger / test.py
Last active July 2, 2017 10:43
SUB + bind - then - PUB + connect
import zmq
context = zmq.Context()
address = "inproc://test"
#subscriber
sub = context.socket(zmq.SUB)
sub.bind(address)
sub.setsockopt(zmq.SUBSCRIBE, "test")
poller = zmq.Poller()
@FirefoxMetzger
FirefoxMetzger / test.py
Last active July 2, 2017 10:43
random poll fixes delivery problem
import zmq
context = zmq.Context()
address = "inproc://test"
#subscriber
sub = context.socket(zmq.SUB)
sub.bind(address)
sub.setsockopt(zmq.SUBSCRIBE, "test")
poller = zmq.Poller()
@FirefoxMetzger
FirefoxMetzger / extract_key.vbs
Last active September 14, 2017 16:06
This useful script reads out the windows registry, extracts the DigitalProductId and converts it into the corresponding Windows License Key. Source: bottom of https://www.howtogeek.com/206329/how-to-find-your-lost-windows-or-office-product-keys/
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
#!/bin/bash
docker-machine create myRegistry -d "virtualbox"
docker-machine ssh myRegistry docker swarm init
docker-machine ssh myRegistry ifconfig eth1
@FirefoxMetzger
FirefoxMetzger / setup.sh
Created November 1, 2017 08:22
Setup of files to be exported to the server for post: https://wordpress.com/post/sebastianwallkoetter.wordpress.com/36
#!/bin/bash
mkdir -p ~/my_docker_registry_deploy_folder/certs
cd ~/my_docker_registry_deploy_folder/
docker pull registry:2
docker save -o registry.tar registry:2