Skip to content

Instantly share code, notes, and snippets.

Itamar Haber itamarhaber

Block or report user

Report or block itamarhaber

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@itamarhaber
itamarhaber / README.md
Created Oct 2, 2018
Naively call RedisTF from Python with redis-py
View README.md
  1. Clone, sh get_deps.sh, and make run https://github.com/lantiga/RedisTF
  2. pip install redis tensorflow
  3. cd models
  4. Run python tf-minimal.py to prepare a minimal graph
  5. The attached redistf-py.py demonstrates how to run the test in the README from Python:
$ python redistf-py.py
Setting the graph: OK
Setting tensor t1: OK
@itamarhaber
itamarhaber / edgex-go-redisdb.md
Created Jul 20, 2018
Edgexfoundry and Redis for Core Data PoC
View edgex-go-redisdb.md

Edgexfoundry and Redis for Core Data PoC

Objectives

  • Implement the Redis client for edgex-go core data client tests/benchmarks
  • Compare between TCP, UDS and embedded Redis connections vs. Mongo's

Setting up

Server set up

@itamarhaber
itamarhaber / some_thoughts.md
Created Feb 23, 2018
Some thoughts about "Building a sliding window rate limiter with Redis"
View some_thoughts.md

Reading Building a sliding window rate limiter with Redis, and w/o addressing the actual logic (which may or may not work).

Optimize by:

  1. Lua seems a much better choice: idiompotent, portable, server-side, less bandwidth, atomic...
  2. The call to ZRANGEBYSCORE seems to be unused, should be commented out if so
  3. Looking at the use of ZRANGE, it appears that ZCARD it what's actually needed

The (untested) Lua snippet:

View xmas.lua
local
h,d,r=9,
0,{} while
h>0 do local
l='' h=h-1 for
x=0, 38 do local
a=x-6 if a<0 then a
= -a end if a <= d then
l = l .. '*' elseif (0.3/
(h+1)) > math.random() then
@itamarhaber
itamarhaber / setbitrange.lua
Last active Dec 20, 2017
A somewhat optimized scripted approach to complementing Redis with a `SETBITRANGE` command
View setbitrange.lua
--[[
Sets a bitmap range
Bitmaps are stored as Strings in Redis. A range spans one or more bytes,
so we can call `SETRANGE` when entire bytes need to be set instead of flipping
individual bits. Also, to avoid multiple internal memory allocations in
Redis, we traverse in reverse.
Expected input:
KEYS[1] - bitfield key
@itamarhaber
itamarhaber / pubsub.py
Created Dec 5, 2017
Threaded Redis PubSub demonstration in Python w/ redis-py
View pubsub.py
# Demonstrates PubSub
import threading
import redis
class Listener(threading.Thread):
def __init__(self, r, p):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
@itamarhaber
itamarhaber / acme-voynich.md
Last active Jul 17, 2017
A friend forwarded me this and swears this is a real email. I read it it like 4 times and I still can't figure out if it is real or shit. True modern day Voynich :)
View acme-voynich.md

To: all@acme.org

From: fjg332@acme.org

Subject: Organizational challenges

Hi, As CDO of this company, it is my job to also to organizate because that's what the big-O in my title is for. Right?

I don't know everything about anything or nothing, but I feel compelled to do my job and clearly organilizing - my expertise after all - is the solution. Since I have the class' attention now I guess I'll need to improvise so:

@itamarhaber
itamarhaber / keybase.md
Created Mar 27, 2017
Keybase.io proof of identity
View keybase.md

Keybase proof

I hereby claim:

  • I am itamarhaber on github.
  • I am itamarhaber (https://keybase.io/itamarhaber) on keybase.
  • I have a public key whose fingerprint is 94E5 0F40 576C 29EA A92A E109 42AF AD7E F4D9 878B

To claim this, I am signing this object:

View orginal-redis-server-logo.txt
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 999.999.999 (3f9e2322/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 16142
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
@itamarhaber
itamarhaber / poem.txt
Created Nov 27, 2016
Me and My Friend ZADD
View poem.txt
This is my friend
His name is ZADD
He's is a lad
Who's always SADD
It's really bad
That ZADD is SADD
I don't know why
And that makes me SCARD
You can’t perform that action at this time.