Skip to content

Instantly share code, notes, and snippets.

View healiseu's full-sized avatar

HEALIS - Healthy Information Systems/Services healiseu

View GitHub Profile

Leave your comments here

  • This is a HEALIS gist for feedback on the web site healis.eu
  • You can use Markup for on your comments
@healiseu
healiseu / rom_upsert.py
Created July 29, 2018 15:53
Redis Object Mapper (ROM) - upsert operation
# (C) By Josiah Carlson
# https://github.com/josiahcarlson/rom/issues/116
#
def create_or_update(cls, data, **by):
entity = cls.get_by(**by)
if not entity:
entity = cls(**data)
else:
for k,v in data.items():
setattr(entity, k, v)
'''
redis_search.py
Written by Josiah Carlson July 3, 2010
Released into the public domain.
This module implements a simple TF/IDF indexing and search algorithm using
Redis as a datastore server. The particular algorithm implemented uses the
# Massive insertion of 1 million float values using Josiah Carlson ROM
# (C) By Athanassios I. Hatzis
# 14 Sept 2018
# Written to explain issue: https://github.com/RedisLabsModules/RediSearch/issues/493
#
from redis import Redis
import numpy as np
import time
import sys
# Massive insertion of 1 million sorted float values using RediSearch module
# (C) By Athanassios I. Hatzis
# 14 Sept 2018
# Written to explain issue: https://github.com/RedisLabsModules/RediSearch/issues/493
#
from redisearch import Client, NumericField, NumericFilter, Query
from redis import Redis
import numpy as np
import time
# Sorted float secondary index: An in-memory data structures comparison of Python, NumPy and Redis data structures
# (C) By Athanassios I. Hatzis
# 18th of September 2018
# Written to explain issue: https://github.com/RedisLabsModules/RediSearch/issues/493
#
# OS Environment: Linux Ubuntu x64
# Processor: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz
# Memory 16 GB
from bisect import bisect_left, bisect_right
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Demo of Infinidat ORM Python Client for Clickhouse\n",
"### Original source at https://github.com/Infinidat/infi.clickhouse_orm\n",
"#### Modified and extended by Athanassios I. Hatzis \n",
"#### (c) 28th of September 2018"
@healiseu
healiseu / infinidat_orm_demo.md
Last active September 28, 2018 21:16
Demo of Infinidat ORM Python Client for Clickhouse
# Massive insertion of 1 million duplets of integer, float values using redis-py
# (C) By Athanassios I. Hatzis
# 30 Sept 2018
# Written to explain issue: https://github.com/andymccurdy/redis-py/issues/850
#
# OS Environment: Linux Ubuntu x64
# Processor: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz
# Memory 16 GB
# Redis Redis 64 bit, v4.0.8, running in standalone mode
#
@healiseu
healiseu / spc_all.tsv
Created January 31, 2019 15:35
Tab Separated File with Header and Missing Values represented with \N
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 15 columns, instead of 5. in line 7.
prtID supID catChk catDate catPrice catTotal prtColor prtName prtUnit prtWeight supAddress supCity supCountry supName supStatus
993 1081 FALSE 2014-03-03 15.3 200 Red Acme Widget Washer kg 142.88 1 Grub St., Potemkin Village, IL 61801 ILLINOIS USA Acme Widget Suppliers 10
994 1081 FALSE 2014-03-03 20.5 100 Silver Acme Widget Washer kg 142.88 1 Grub St., Potemkin Village, IL 61801 ILLINOIS USA Acme Widget Suppliers 10
995 1081 FALSE \N 20.5 \N \N I Brake for Crop Circles Sticker \N \N 1 Grub St., Potemkin Village, IL 61801 ILLINOIS USA Acme Widget Suppliers 10
999 1081 FALSE \N 75.2 \N Green 7 Segment Display gr 2.1 1 Grub St., Potemkin Village, IL 61801 ILLINOIS USA Acme Widget Suppliers 10
996 1081 FALSE \N 124.23 \N Cyan Anti-Gravity Turbine Generator \N \N 1 Grub St., Potemkin Village, IL 61801 ILLINOIS USA Acme Widget Suppliers 10
997 1081 FALSE \N 124.23 \N Magenta Anti-Gravity Turbine Generator \N \N 1 Grub St., Potemkin Village, IL 61801 ILLINOIS USA Acme Widget Suppliers 10
998 1081 TRUE 2014-09-10 11