- Python 3.9+
- Redis & RedisJSON 2.0
## if you want to run the container locally
docker run -d -p 6379:6379 redislabs/rejson:preview
pip3 install poetry
poetry install
from subprocess import check_output | |
from uuid import uuid4 | |
from redis import Redis | |
PORT = 19475 | |
SHARD_IDS = [1,2,3,4] | |
R = Redis(port=PORT) | |
## keys is unsafe for production as it can block for a long time - use scan instead if testing there | |
_shard_keys_command = lambda shard_id, pattern: ['/opt/redislabs/bin/shard-cli', str(shard_id), 'keys', str(pattern)] |
# Redis configuration file example | |
# Note on units: when memory size is needed, it is possible to specify | |
# it in the usual form of 1k 5GB 4M and so forth: | |
# | |
# 1k => 1000 bytes | |
# 1kb => 1024 bytes | |
# 1m => 1000000 bytes | |
# 1mb => 1024*1024 bytes | |
# 1g => 1000000000 bytes |
#pip installed | |
from appscript import app | |
QUICKTIME = '/Applications/Quicktime Player 7.app' | |
def offset_audio(file, offset_amount): | |
##Open the video | |
vid = app(QUICKTIME).open(file) | |
##Find the audio track |
import math, os, signal, hashlib | |
from glob import glob | |
from filechunkio import FileChunkIO | |
from boto import connect_s3 | |
from boto.s3.key import Key | |
from gevent import sleep | |
from gevent.pool import Pool | |
from gevent.event import Event |
import signal | |
from os import getpid | |
from time import sleep | |
def never_die(signal, frame): | |
while True: | |
print "Can't stop won't stop" | |
signal.signal(signal.SIGTERM, never_die) |
class Tree(object): | |
def __init__(self, root=None): | |
self.root = root | |
@classmethod | |
def from_string(cls, tree_string): | |
raise NotImplementedError | |
def __contains__(self, item): | |
if isinstance(item, Node): |