Skip to content

Instantly share code, notes, and snippets.


Blake VandeMerwe blakev

View GitHub Profile
5agado / Pandas and Seaborn.ipynb
Created Feb 20, 2017
Data Manipulation and Visualization with Pandas and Seaborn — A Practical Introduction
View Pandas and Seaborn.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Spindel /
Created Dec 9, 2016
Direct IO in Python
#!/bin/env python3
import os
import mmap
import logging
import hashlib
import contextlib
log = logging.getLogger(__name__)
def directio_mmap(filename, readsize, offset):
Manu343726 / gist:ca0ceb224ea789415387
Created Sep 19, 2015
Running ARM docker image with QEMU on x86_64 Arch Linux host
View gist:ca0ceb224ea789415387
# Install quemu, docker, etc
yaourt -S qemu qemu-user-static binfmt-support
# The quemu-user-static AUR package is outdated and broken. The .deb package they pull is no longer in the ubuntu repository.
# Edit the PKGBUILD and use qemu-user-static_2.4+dfsg-3_amd64.deb (With SHA1 sum "84d83a16c60c82b6c579f2f750b04a3ac26c249b")
# Enable ARM emulation
update-binfmts --enable qemu-arm
eulerfx /
Last active Mar 29, 2022
The relationship between state machines and event sourcing

A state machine is defined as follows:

  • Input - a set of inputs
  • Output - a set of outputs
  • State - a set of states
  • S0 ∈ S - an initial state
  • T : Input * State -> Output * State - a transition function

If you model your services (aggregates, projections, process managers, sagas, whatever) as state machines, one issue to address is management of State. There must be a mechanism to provide State to the state machine, and to persist resulting State for subsequent retrieval. One way to address this is by storing State is a key-value store. Another way is to use a SQL database. Yet another way is event sourcing. The benefit of even sourcing is that you never need to store State itself. Instead, you rely on the Output of a service to reconstitute state. In order to do that, the state machine transition function needs to be factored into two functions as follows:

rdb /
Last active Jul 12, 2022
Access joysticks/game controllers from Python in Linux via the joystick driver. See
# Released by rdb under the Unlicense (
# Based on information from:
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
davispuh / bitcoind.service
Created Jan 6, 2014
Bitcoin-daemon service file for Systemd
View bitcoind.service
Description=Bitcoin daemon serivce
plentz / nginx.conf
Last active Sep 27, 2022
Best nginx configuration for improved security(and performance)
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
batok /
Created Apr 10, 2012
Paramiko example using private key
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
print "connecting"
c.connect( hostname = "", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/", "/home/ubuntu/" ]
for command in commands:
print "Executing {}".format( command )