Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Blake VandeMerwe blakev

🎯
Focusing
View GitHub Profile
@5agado
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
Spindel / directio_mmap.py
Created Dec 9, 2016
Direct IO in Python
View directio_mmap.py
#!/bin/env python3
import os
import mmap
import logging
import hashlib
import contextlib
log = logging.getLogger(__name__)
@contextlib.contextmanager
def directio_mmap(filename, readsize, offset):
@Manu343726
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
eulerfx / EventMachines.md
Last active Mar 29, 2022
The relationship between state machines and event sourcing
View EventMachines.md

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
rdb / js_linux.py
Last active Jul 12, 2022
Access joysticks/game controllers from Python in Linux via the joystick driver. See https://discourse.panda3d.org/t/game-controllers-on-linux-without-pygame/14128
View js_linux.py
# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
@davispuh
davispuh / bitcoind.service
Created Jan 6, 2014
Bitcoin-daemon service file for Systemd
View bitcoind.service
[Unit]
Description=Bitcoin daemon serivce
After=network.target
[Service]
Type=simple
User=bitcoin
ExecStart=/usr/bin/bitcoind
[Install]
@plentz
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
batok / paramiko_example.py
Created Apr 10, 2012
Paramiko example using private key
View paramiko_example.py
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )