Skip to content

Instantly share code, notes, and snippets.

View julianpistorius's full-sized avatar

Julian Pistorius julianpistorius

View GitHub Profile
"""
Turn a piano MIDI file into a basic 3D animated piano video.
See the result here:
I am leaving it as a script because it is not tested on enough MIDI files yet.
Zulko 2014
This script is released under a Public Domain (Creative Commons 0) licence.
#!/usr/bin/env python2
import boto
from collections import defaultdict
from pprint import pprint
import os, sys
DIVIDER = """
===========================================
======== ec2-instances ========
#!/usr/bin/env python2
# coding: utf-8
import os,socket,threading,time
#import traceback
allow_delete = False
local_ip = socket.gethostbyname(socket.gethostname())
local_port = 8888
currdir=os.path.abspath('.')
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@julianpistorius
julianpistorius / externalcall.py
Created December 17, 2015 03:13 — forked from simon-weber/externalcall.py
Custom tooling to ease VCR.py management.
import vcrutils
VCR_CASSETTE_PATH = APPROOT + '/venmo_tests/cassettes/' # eg
MAKE_EXTERNAL_REQUESTS = os.environ.get('MAKE_EXTERNAL_REQUESTS') == 'TRUE'
@dual_decorator # convert a paramaterized decorator for no-arg use (https://gist.github.com/simon-weber/9956622).
def external_call(*args, **kwargs):
"""Enable vcrpy to store/mock http requests.
@julianpistorius
julianpistorius / .gitignore
Created March 15, 2016 19:54 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@julianpistorius
julianpistorius / Get public ip
Created March 22, 2016 17:37 — forked from ostholz/Get public ip
curl get public ip address
curl ifconfig.me
@julianpistorius
julianpistorius / MyConsumer.java
Created June 6, 2016 02:02 — forked from cjmamo/MyConsumer.java
Apache Kafka for Event Sourcing
...
public class MyConsumer {
private static final int SO_TIMEOUT = 100000; // socket timeout
private static final int BUFFER_SIZE = 64 * 1024; // maximum socket receive buffer in bytes
private static final int FETCH_SIZE = 100000; // maximum bytes to fetch from topic
public static void main(String args[]) {
MyConsumer myConsumer = new MyConsumer();
@julianpistorius
julianpistorius / behave-parallel.py
Created July 12, 2016 22:46 — forked from remcowesterhoud/behave-parallel.py
All credit goes to s1ider https://gist.github.com/s1ider/f13c2f163282dbec7a61. All I did was fix it up, made it work in Python3 and added Behave Userdata support
"""
Behave runner for running features asynchronously.
"""
from multiprocessing import Pool
from subprocess import call, Popen, PIPE
from glob import glob
import logging
import argparse
import json
from functools import partial
@julianpistorius
julianpistorius / quilt_proposal.edn
Created July 28, 2016 06:46 — forked from tgk/quilt_proposal.edn
An attempt at understanding Quilt
;; These notes describe the snapshots of a shared state between
;; pariticipants in a system co-ordinated using CRDT methods, hopefully
;; matching the Quilt notes from @cemerick at
;; http://writings.quilt.org/2014/05/12/distributed-systems-and-the-end-of-the-api/
;; The ambition is to built systems where network failures, replays
;; etc. can be safely ignored (instead of just being ignored).
;; Maintaining the "timestamps" for the append only database is the only
;; thing I feel I don't grok. There are some notes at the end of the
;; gist. Hoping for feedback or pointers!