Skip to content

Instantly share code, notes, and snippets.

@itamarhaber
itamarhaber / setbitrange.lua
Last active September 30, 2021 17:03
A somewhat optimized scripted approach to complementing Redis with a `SETBITRANGE` command
--[[
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 December 5, 2017 15:38
Threaded Redis PubSub demonstration in Python w/ redis-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 July 17, 2017 11:30
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 :)

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 March 27, 2017 19:11
Keybase.io proof of identity

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:

@itamarhaber
itamarhaber / orginal-redis-server-logo.txt
Last active October 30, 2021 10:28
Redis ASCII logos
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 999.999.999 (3f9e2322/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 16142
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
@itamarhaber
itamarhaber / poem.txt
Created November 27, 2016 13:25
Me and My Friend ZADD
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
@itamarhaber
itamarhaber / .gitignore
Last active October 21, 2017 22:34
Cron-like Redis module
*.xo
*.so
*.o
@itamarhaber
itamarhaber / Makefile
Last active August 8, 2023 15:47
Module development environment walkthrough
SHOBJ_CFLAGS ?= -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -shared -Bsymbolic
CFLAGS = -Wall -g -fPIC -lc -lm -Og -std=gnu99
CC=gcc
all: example.so
example.so: example.o
$(LD) -o $@ example.o $(SHOBJ_LDFLAGS) $(LIBS) -lc
#!/bin/bash
# Why? Education & zero redis-cli dependecy
# (it is a shame, however, that this functionality isn't a part of redis-cli... PR on the way)
HOST=127.0.0.1
PORT=6379
if [ $# -lt "2" ]
then
echo "Call a Redis command with its last argument being file contents"
echo "Usage: $0 <Redis command> <keys and arguments for command> <payload>"
@itamarhaber
itamarhaber / luainsider.md
Last active April 10, 2021 19:09
A micro OSS project, blog post or an addition to http://redis.io/topics|commands/eval|evalsha?

Luainsider - manage your Redis Lua scripts like a pro

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)

Description