A methodology, approach and apparatus for semi-persisting and aliasing Redis Lua scripts.
FAIR WARNING: this is WIP (i.e. could blow in your face)
import binascii | |
from Crypto.Cipher import AES | |
from Crypto.Random.random import getrandbits | |
from hashlib import md5 | |
from schematics.types import StringType | |
import struct | |
class DecryptionException(Exception): | |
pass |
# Courtesy of https://github.com/wimglenn | |
import sys | |
try: | |
import builtins | |
except ImportError: | |
# py2 | |
import __builtin__ as builtins |
# Delete the possibly existing autocomplete test index | |
curl -X DELETE localhost:9200/autocomplete_test | |
# Put the config of the autocomplete index | |
curl -X PUT localhost:9200/autocomplete_test -d ' | |
{ | |
"settings" : { | |
"index" : { | |
"analysis" : { | |
"analyzer" : { |
% Copyright (c) 2010-2014, Lars Buitinck | |
% May be used, redistributed and modified under the terms of the | |
% GNU Lesser General Public License (LGPL), version 2.1 or later | |
% Heaps/priority queues in Erlang | |
% Heaps are data structures that return the entries inserted into them in | |
% sorted order. This makes them the data structure of choice for implementing | |
% priority queues, a central element of algorithms such as best-first/A* | |
% search and Kruskal's minimum-spanning-tree algorithm. |
import psycopg2.extras | |
import sqlalchemy.dialects.postgresql | |
from sqlalchemy.types import TypeEngine | |
from sqlalchemy.types import String | |
from sqlalchemy.types import TypeDecorator | |
import uuid | |
# Required for PostgreSQL to accept UUID type. | |
psycopg2.extras.register_uuid() |
from abc import ABC, ABCMeta, abstractmethod | |
from collections import namedtuple | |
from itertools import count | |
PayloadFactory = namedtuple('PayloadFactory', [ | |
'good', 'created', 'queued', 'unchanged', 'requires_auth', | |
'permission_denied', 'not_found', 'invalid', 'error' | |
]) | |
""" |
A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."
The standard names for indexes in PostgreSQL are:
{tablename}_{columnname(s)}_{suffix}
where the suffix is one of the following:
pkey
for a Primary Key constraint;key
for a Unique constraint;excl
for an Exclusion constraint;idx
for any other kind of index;
rsync (Everyone seems to like -z, but it is much slower for me)