Saturday, October 28, 2023

EV: BMW i7

The Most Tech I've Ever Seen in a Car! - YouTube


BMW i7 Electric Luxury Sedan | BMW USA


VSCode extension: HTML Preview

 HTML Preview - Visual Studio Marketplace

811K downloads

george-alisson/html-preview-vscode: A HTML previewer for Visual Studio Code @GitHub


HTML to Markdown Converter (online tool)



Redis JSON, with Docker

 JSON | Redis

The JSON capability of Redis Stack provides JavaScript Object Notation (JSON) support for Redis. It lets you store, update, and retrieve JSON values in a Redis database, similar to any other Redis data type. Redis JSON also works seamlessly with Search and Query to let you index and query JSON documents.

not "free", much bigger size than standard Redis

https://hub.docker.com/r/redis/redis-stack/tags

redis-stack: 337 MB compressed, linux/amd64

https://hub.docker.com/_/redis/tags

redis: 49 MB compressed, linux/amd64

docker run -d --name redis-stack -p 6380:6379 redis/redis-stack
docker exec -it redis-stack sh

# redis-cli
ping
PONG

JSON.SET enterprise . '{"captain": "kirk"}'
JSON.GET enterprise
{"captain": "kirk"}
JSON.SET enterprise .designation '{"NCC-1701"}'
JSON.GET enterprise
{"captain": "kirk", "designation": "NCC-1701"}

exit
exit

https://redis.io/docs/data-types/json/#run-with-docker

python example

> pip install redis > python redis-json.py

import redis
data = {
    'dog': {
        'scientific-name' : 'Canis familiaris'
    }
}
r = redis.Redis(host='localhost', port=6380, decode_responses=True)
r.json().set('doc', '$', data)
doc = r.json().get('doc', '$')
dog = r.json().get('doc', '$.dog')
scientific_name = r.json().get('doc', '$..scientific-name')
print(scientific_name) # ['Canis familiaris']