Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am billyshambrook on github.
  • I am bshambrook (https://keybase.io/bshambrook) on keybase.
  • I have a public key whose fingerprint is 798D 93CE 8981 64CD 1D14 1608 A7A4 98D4 D12A 0D17

To claim this, I am signing this object:

@billyshambrook
billyshambrook / gist:c00e50e5a05bb03cbba86f9c12d4f487
Created August 22, 2017 19:51
Generate cloudfront signed url
"""
Make sure you have "cryptography" and "botocore" installed!
"""
import datetime
import functools
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
@billyshambrook
billyshambrook / main.py
Created March 3, 2017 23:47
Catch essential container result from sidecar container in ECS
import logging
import signal
import socket
import sys
import docker
import boto3
logging.basicConfig(level=logging.INFO)
import asyncio
import json
import re
import subprocess
import aioamqp
async def rsync(loop):
""" """
transport, protocol = await aioamqp.connect()
@billyshambrook
billyshambrook / conftest.py
Last active March 19, 2018 17:26
Categorise integration tests using PyTest.
import pytest
def pytest_addoption(parser):
parser.addoption("--integration", action="store_true", help="run integration tests")
def pytest_runtest_setup(item):
if 'integration' in item.keywords:
item.config.getoption("--integration", skip=True)
@billyshambrook
billyshambrook / multi_channels.py
Created November 10, 2015 17:06
Multiple channel pika consumer
import logging
import time
import pika
logger = logging.getLogger(__name__)
class Channel(object):
@billyshambrook
billyshambrook / debug_qtsignals_with_graph.py
Last active October 1, 2020 05:44
Debug Qt Signals with graph
import functools
import inspect
import graphviz
from PyQt4 import QtCore
from PyQt4 import QtGui
class MyGraph(object):
def __init__(self):
@billyshambrook
billyshambrook / debug_qtsignals.py
Last active October 1, 2020 05:39
Debug QT Signals
import functools
import inspect
import log
from PyQt4 import QtCore
from PyQt4 import QtGui
logger = log.getLogger(__name__)
"""
Requires FFprobe installed.
"""
import argparse
import json
import logging
import subprocess
logger = logging.getLogger('encode_tests')
@billyshambrook
billyshambrook / chunk.sh
Created April 1, 2015 20:44
chunk content
ffmpeg -i input.mpg -map 0 -c copy -an -f segment -reset_timestamps 1 -segment_time 10