Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastian Wallkötter FirefoxMetzger

View GitHub Profile
View in_place_sorting.cpp
#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 Jul 2, 2017
ZMQ inproc connect then bind
View test.py
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 Jul 2, 2017
PUB + connect - then - SUB + bind
View test.py
import zmq
context = zmq.Context()
address = "inproc://test"
#publisher
pub = context.socket(zmq.PUB)
pub.connect(address)
#subscriber
@FirefoxMetzger
FirefoxMetzger / test.py
Last active Jul 2, 2017
PUB + bind - then - SUB + connect
View test.py
import zmq
context = zmq.Context()
address = "inproc://test"
#publisher
pub = context.socket(zmq.PUB)
pub.bind(address)
#subscriber
@FirefoxMetzger
FirefoxMetzger / test.py
Last active Jul 2, 2017
SUB + connect - then - PUB + bind
View test.py
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 Jul 2, 2017
SUB + bind - then - PUB + connect
View test.py
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 Jul 2, 2017
random poll fixes delivery problem
View test.py
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 / Dockerfile
Created Sep 4, 2017
Dockerfile for openAI gym with added dependencies
View Dockerfile
# A Dockerfile that sets up a full Gym install
FROM ubuntu:14.04
RUN apt-get update \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
python-setuptools \
libpq-dev \
@FirefoxMetzger
FirefoxMetzger / extract_key.vbs
Last active Sep 14, 2017
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/
View extract_key.vbs
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
View setup.sh
#!/bin/bash
docker-machine create myRegistry -d "virtualbox"
docker-machine ssh myRegistry docker swarm init
docker-machine ssh myRegistry ifconfig eth1