Skip to content

Instantly share code, notes, and snippets.


Adi Wabisabi timeartist

  • Redis
  • 8500 ft
View GitHub Profile
timeartist /
Last active Nov 9, 2021
One File Product Catalog Service


  • Python 3.9+
  • Redis & RedisJSON 2.0

To run:

## if you want to run the container locally
docker run -d -p 6379:6379 redislabs/rejson:preview
pip3 install poetry
poetry install
timeartist /
Created Feb 28, 2018
Creating Deterministic Shard Sentinel Value keys
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)]
View redis-no-save.conf
# 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'
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
View gist:3b9dec6720c595c694b8
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)
View gist:288d916d5d26cef4569c
class Tree(object):
def __init__(self, root=None):
self.root = root
def from_string(cls, tree_string):
raise NotImplementedError
def __contains__(self, item):
if isinstance(item, Node):