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 / test_caching.sh
Last active March 4, 2016 00:23
Test if a proxy (polipo) is caching correctly
curl -s --head --proxy http://127.0.0.1:8123/ http://google.com
curl -s --head http://google.com
curl -s --head --proxy http://127.0.0.1:8123/ http://google.com
ls -al /usr/local/var/cache/polipo/
ls -al /usr/local/var/cache/polipo/google.com/
@julianpistorius
julianpistorius / screen_output_save.sh
Created March 7, 2016 17:22
Leave remote command running storing output. #tip #linux #screen
# http://unix.stackexchange.com/questions/34321/leave-remote-command-running-storing-output/39720#39720
# In one session:
screen -L -S <screen_name>
# Then later from a different session:
tail -F <screen_name>.log
@julianpistorius
julianpistorius / colorized_output
Created March 7, 2016 19:26
Colorized output using Generic Colouriser
# See:
# http://unix.stackexchange.com/questions/8414/how-to-have-tail-f-show-colored-output/21962#21962
# http://korpus.juls.savba.sk/~garabik/software/grc.html
grc tail -f /var/log/apache2/error.log
@julianpistorius
julianpistorius / ceilometer.bash_completion
Created March 15, 2016 00:06
Bash completion for OpenStack Ceilometer
# Copied from here:
# https://github.com/openstack/python-ceilometerclient/blob/master/tools/ceilometer.bash_completion
# bash completion for openstack ceilometer
_ceilometer_opts="" # lazy init
_ceilometer_flags="" # lazy init
_ceilometer_opts_exp="" # lazy init
_ceilometer()
{
local cur prev kbc
@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 #