Skip to content

Instantly share code, notes, and snippets.

@itamarhaber
itamarhaber / scan_del.sh
Created April 20, 2014 22:27
A bash script that deletes Redis keys by pattern using SCAN
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Delete keys from Redis matching a pattern using SCAN & DEL"
echo "Usage: $0 <host> <port> <pattern>"
exit 1
fi
cursor=-1
@itamarhaber
itamarhaber / external-references.md
Last active August 13, 2020 19:21
20150903 Ask a Redis Expert Webinar - Why Your MongoDBNeeds Redis
*3
$3
SET
$3
key
$5
value
@itamarhaber
itamarhaber / docs.Dockerfile
Last active February 2, 2020 16:49
structor mkdocs
FROM alpine
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin
COPY requirements.txt /mkdocs/
WORKDIR /mkdocs
RUN apk --update upgrade \
&& apk --no-cache --no-progress add py-pip \
&& rm -rf /var/cache/apk/* \

ACL v6RC1 default app profile

The purpose of this exercise is to define a "default" application ACL profile that can access the all the data without being able to cause too much harm.

Additive ("future-proof") profile

Required extra permissions:

  • All functional categories
  • CLIENT ID|GETNAME|REPLY|SETNAME|TRACKING|GETREDIR: must for modern clients
  • CLUSTER COUNTKEYSINSLOT|GETKEYSINSLOT|INFO|KEYSLOT|MYID|NODES|SLOTS: must for cluster-aware clients
@itamarhaber
itamarhaber / Redis SCAN by "regex"
Last active May 21, 2019 13:24
Regex-like key name pattern matching in Redis
foo@bar:~$ redis-cli
127.0.0.1:6379> dbsize
(integer) 0
127.0.0.1:6379> set user:1 1
OK
127.0.0.1:6379> set use:the:force luke
OK
127.0.0.1:6379> set non:user a
OK
foo@bar:~$ redis-cli --eval scanregex.lua , "^user"
@itamarhaber
itamarhaber / method-1-binary-file.md
Last active May 16, 2019 17:27
Loading a binary value from a file with redis-cli

Create the file with the actual bytes, not the '\xnn\ representation. For example, in Python:

f = open('filename', 'w')
f.write('\x01\x02\x03')
f.close()

Load the file with redis-cli -x set keyname &lt; filename

@itamarhaber
itamarhaber / index.html
Last active March 29, 2019 02:26
Red is Beautiful: A Visualization of Redis Commands
<!DOCTYPE html>
<!--
Red is Beautiful: A Visualization of Redis Commands
By Itamar Haber, Redis Labs
Adopted from Mike Bostock's Zoomable Pack Layout example: http://mbostock.github.io/d3/talk/20111116/pack-hierarchy.html
!-->
<html>
<head>
<style>
@itamarhaber
itamarhaber / README.md
Created October 2, 2018 22:01
Naively call RedisTF from Python with redis-py
  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 July 20, 2018 16:41
Edgexfoundry and Redis for Core Data PoC

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