This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import redis | |
client = redis.StrictRedis( | |
host='hostname', | |
port=6379, | |
db=0, | |
password='password', | |
ssl=True, | |
ssl_cert_reqs=None | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export data from source postgresql database. | |
pg_dump --format=custom --no-owner --verbose --file=backup.dump "$SOURCE_URL" | |
# Restore the data to the target postgresql database. | |
pg_restore --clean --if-exists --no-owner --verbose --dbname="$TARGET_URL" backup.dump |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Consumer Sample for NATS | |
It creates a "durable pull consumer" named "TEST_DURABLE". | |
The consumer only listens to the "TEST.pushed" subject. | |
It prints the json messages pushed to the "TEST.pushed" subject.""" | |
import asyncio | |
import json | |
from nats.aio.client import Client as NATS | |
async def main(): | |
nc = NATS() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
If you have a project with requirements/base.txt, requirements/local.txt, requirements/production.txt, | |
and you want to use uv for managing dependencies, this script will read all those deps from txt files | |
and adds to pyproject.toml so that you can install them with | |
uv sync --extra local | |
uv sync --extra production | |
""" |
OlderNewer