summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:38:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:38:04 +0000
commite0847dd62461001851da4c89f279e16b14c3eb4c (patch)
tree87422376dd9a7eee55850f0fce9a8bb4c13e44a2 /scripts
parentInitial commit. (diff)
downloadiredis-0ef2b3395587aa620326962d51fd004ccc21b0bd.tar.xz
iredis-0ef2b3395587aa620326962d51fd004ccc21b0bd.zip
Adding upstream version 1.13.0.upstream/1.13.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--scripts/add_fooset_commands.txt1
-rw-r--r--scripts/add_hash.txt3
-rw-r--r--scripts/add_lists.txt3
-rw-r--r--scripts/add_myzset_commands.txt52
-rwxr-xr-xscripts/check_renders.sh1
-rw-r--r--scripts/conf/slave/slave.conf2
-rw-r--r--scripts/display_all_command_hints.py7
-rwxr-xr-xscripts/download_redis_commands.py50
-rw-r--r--scripts/multi_del.txt4
-rw-r--r--scripts/redis.conf4
-rw-r--r--scripts/set_999_keys_in_redis.py6
-rwxr-xr-xscripts/tcp-proxy.sh20
-rwxr-xr-xscripts/update_command_from_redis_doc.sh1
13 files changed, 154 insertions, 0 deletions
diff --git a/scripts/add_fooset_commands.txt b/scripts/add_fooset_commands.txt
new file mode 100644
index 0000000..92b0312
--- /dev/null
+++ b/scripts/add_fooset_commands.txt
@@ -0,0 +1 @@
+SADD fooset alligator ant bear bee bird camel cat cheetah chicken chimpanzee cow crocodile deer dog dolphin duck eagle elephant fish fly fox frog giraffe goat goldfish hamster hippopotamus horse kangaroo kitten lion lobster monkey octopus owl panda pig puppy rabbit rat scorpion seal shark sheep snail snake spider squirrel tiger turtle wolf zebra
diff --git a/scripts/add_hash.txt b/scripts/add_hash.txt
new file mode 100644
index 0000000..b42e716
--- /dev/null
+++ b/scripts/add_hash.txt
@@ -0,0 +1,3 @@
+HMSET hash1 Tolerant intolerant Decent indecent Discrete indiscreet Excusable inexcusable
+HMSET hash2 Behave misbehave Interpret misinterpret Lead mislead Trust mistrust Likely unlikely Able unable Fortunate unfortunate Forgiving unforgiving
+HMSET hash3 Entity nonentity Conformist nonconformist Payment nonpayment Sense nonsense
diff --git a/scripts/add_lists.txt b/scripts/add_lists.txt
new file mode 100644
index 0000000..f8b7542
--- /dev/null
+++ b/scripts/add_lists.txt
@@ -0,0 +1,3 @@
+LPUSH list:animals alligator ant bear bee bird camel cat cheetah chicken chimpanzee cow crocodile deer dog dolphin duck eagle elephant fish fly fox frog giraffe goat goldfish hamster hippopotamus horse kangaroo kitten lion lobster monkey octopus owl panda pig puppy rabbit rat scorpion seal shark sheep snail snake spider squirrel tiger turtle wolf zebra
+LPUSH list:buildings "airport" "apartment building" "bank" "barber shop" "book store" "bowling alley" "bus stop" "church" "convenience store" "department store" "fire department" "gas station" "hospital" "house" "library" "movie theater" "museum" "office building" "post office" "restaurant" "school" "mall" "supermarket" "train station"
+LPUSH list:restaurant bill breakfast check cup dessert dinner dressing drink fork hamburger knife lunch menu napkin order salt spoon water coffee tea
diff --git a/scripts/add_myzset_commands.txt b/scripts/add_myzset_commands.txt
new file mode 100644
index 0000000..4532d60
--- /dev/null
+++ b/scripts/add_myzset_commands.txt
@@ -0,0 +1,52 @@
+ZADD myzset 28693 alligator
+ZADD myzset 29596 ant
+ZADD myzset 11320 bear
+ZADD myzset 28872 bee
+ZADD myzset 26656 bird
+ZADD myzset 708 camel
+ZADD myzset 31829 cat
+ZADD myzset 7424 cheetah
+ZADD myzset 30668 chicken
+ZADD myzset 154 chimpanzee
+ZADD myzset 24709 cow
+ZADD myzset 25916 crocodile
+ZADD myzset 6888 deer
+ZADD myzset 32034 dog
+ZADD myzset 15528 dolphin
+ZADD myzset 667 duck
+ZADD myzset 202 eagle
+ZADD myzset 19551 elephant
+ZADD myzset 32231 fish
+ZADD myzset 4002 fly
+ZADD myzset 18679 fox
+ZADD myzset 10147 frog
+ZADD myzset 28405 giraffe
+ZADD myzset 15557 goat
+ZADD myzset 2062 goldfish
+ZADD myzset 25018 hamster
+ZADD myzset 19888 hippopotamus
+ZADD myzset 24984 horse
+ZADD myzset 16088 kangaroo
+ZADD myzset 7907 kitten
+ZADD myzset 9814 lion
+ZADD myzset 32194 lobster
+ZADD myzset 8036 monkey
+ZADD myzset 19483 octopus
+ZADD myzset 9398 owl
+ZADD myzset 24987 panda
+ZADD myzset 28153 pig
+ZADD myzset 28829 puppy
+ZADD myzset 9709 rabbit
+ZADD myzset 14184 rat
+ZADD myzset 11208 scorpion
+ZADD myzset 11385 seal
+ZADD myzset 1900 shark
+ZADD myzset 6890 sheep
+ZADD myzset 6897 snail
+ZADD myzset 7659 snake
+ZADD myzset 22338 spider
+ZADD myzset 3676 squirrel
+ZADD myzset 1490 tiger
+ZADD myzset 31275 turtle
+ZADD myzset 8113 wolf
+ZADD myzset 1601 zebra
diff --git a/scripts/check_renders.sh b/scripts/check_renders.sh
new file mode 100755
index 0000000..f84602e
--- /dev/null
+++ b/scripts/check_renders.sh
@@ -0,0 +1 @@
+rg -vw render_int iredis/data/command_syntax.csv | rg -vw render_simple_string | rg -wv render_bulk_string | rg -vw render_list | rg -vw render_members | rg -vw render_bulk_string_decode | rg -vw render_string_or_int | rg -wv render_list_or_string
diff --git a/scripts/conf/slave/slave.conf b/scripts/conf/slave/slave.conf
new file mode 100644
index 0000000..f8749d9
--- /dev/null
+++ b/scripts/conf/slave/slave.conf
@@ -0,0 +1,2 @@
+slaveof localhost 6379
+port 6479
diff --git a/scripts/display_all_command_hints.py b/scripts/display_all_command_hints.py
new file mode 100644
index 0000000..9f13a4c
--- /dev/null
+++ b/scripts/display_all_command_hints.py
@@ -0,0 +1,7 @@
+from iredis.utils import command_syntax
+from iredis.style import STYLE
+from iredis.commands import commands_summary
+from prompt_toolkit import print_formatted_text
+
+for command, info in commands_summary.items():
+ print_formatted_text(command_syntax(command, info), style=STYLE)
diff --git a/scripts/download_redis_commands.py b/scripts/download_redis_commands.py
new file mode 100755
index 0000000..4dda6b8
--- /dev/null
+++ b/scripts/download_redis_commands.py
@@ -0,0 +1,50 @@
+#!python3
+
+"""
+Download all Reids commands from https://redis.io/commands.
+Output to csv format.
+"""
+import sys
+import csv
+
+from lxml import etree
+import requests
+
+stdout_writer = csv.writer(sys.stdout)
+
+
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
+
+eprint("Download https://redis.io/commands page...")
+page = requests.get("https://redis.io/commands").text
+eprint("Download finished!")
+
+eprint("Start prase page...")
+html = etree.HTML(page)
+commands = html.xpath("//div[@class='container']/ul/li")
+stdout_writer.writerow(["Group", "Command", "Args", "Summary", "Redis.io link"])
+command_rows = []
+# parse page
+for command in commands:
+ group = command.attrib["data-group"]
+ command_name = command.xpath("./a/span[@class='command']/text()")[0].strip()
+ command_args = command.xpath(
+ "./a/span[@class='command']/span[@class='args']/text()"
+ )[0].strip()
+ command_summary = command.xpath("./a/span[@class='summary']/text()")[0].strip()
+ command_link = "https://redis.io" + command.xpath("./a/@href")[0].strip()
+ command_rows.append(
+ [
+ group,
+ command_name,
+ " ".join(command_args.split()),
+ command_summary,
+ command_link,
+ ]
+ )
+# write to stdout
+for row in sorted(command_rows):
+ stdout_writer.writerow(row)
+eprint("Down.")
diff --git a/scripts/multi_del.txt b/scripts/multi_del.txt
new file mode 100644
index 0000000..685cb03
--- /dev/null
+++ b/scripts/multi_del.txt
@@ -0,0 +1,4 @@
+DEL key-001
+DEL key-002
+DEL key-003
+DEL key-004
diff --git a/scripts/redis.conf b/scripts/redis.conf
new file mode 100644
index 0000000..368a34c
--- /dev/null
+++ b/scripts/redis.conf
@@ -0,0 +1,4 @@
+port 7379
+unixsocket /tmp/redis.sock
+unixsocketperm 775
+aclfile /tmp/redis.acl
diff --git a/scripts/set_999_keys_in_redis.py b/scripts/set_999_keys_in_redis.py
new file mode 100644
index 0000000..9a65f04
--- /dev/null
+++ b/scripts/set_999_keys_in_redis.py
@@ -0,0 +1,6 @@
+import redis
+
+client = redis.StrictRedis(db=3)
+
+for i in range(100000):
+ client.set(f"key-{i}", "hello world")
diff --git a/scripts/tcp-proxy.sh b/scripts/tcp-proxy.sh
new file mode 100755
index 0000000..ff0ce53
--- /dev/null
+++ b/scripts/tcp-proxy.sh
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+# Display TCP packets
+# code from:
+# https://notes.tweakblogs.net/blog/7955/using-netcat-to-build-a-simple-tcp-proxy-in-linux.html
+
+if [ $# != 3 ]
+then
+ echo "usage: $0 <src-port> <dst-host> <dst-port>"
+ exit 0
+fi
+
+TMP=`mktemp -d`
+BACK=$TMP/pipe.back
+SENT=$TMP/pipe.sent
+RCVD=$TMP/pipe.rcvd
+trap 'rm -rf "$TMP"' EXIT
+mkfifo -m 0600 "$BACK" "$SENT" "$RCVD"
+sed 's/^/ => /' <"$SENT" &
+sed 's/^/<= /' <"$RCVD" &
+nc -l 127.0.0.1 "$1" <"$BACK" | tee "$SENT" | nc "$2" "$3" | tee "$RCVD" >"$BACK"
diff --git a/scripts/update_command_from_redis_doc.sh b/scripts/update_command_from_redis_doc.sh
new file mode 100755
index 0000000..7cc161f
--- /dev/null
+++ b/scripts/update_command_from_redis_doc.sh
@@ -0,0 +1 @@
+wget https://raw.githubusercontent.com/antirez/redis-doc/master/commands.json -O commands.json