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
| #!sh | |
| function ds () { | |
| aws dynamodbstreams describe-stream --stream-arn $1 | |
| } | |
| function gsi () { | |
| aws dynamodbstreams get-shard-iterator --stream-arn --shard-iterator-type LATEST --shard-id $1 | |
| } | |
| function gr () { |
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
| cd dynamoLocalDirectory | |
| # run the java command | |
| java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb | |
| #don't close this terminal, open another window | |
| #create the table using a json file | |
| aws dynamodb create-table | |
| --cli-input-json file:///Users/davidericci/Projects/meteosuper-api/localDynamo/create-forecastTable.json | |
| --endpoint-url http://localhost:8000 | |
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 sys | |
| import csv | |
| import math | |
| from decimal import Decimal | |
| from time import sleep | |
| from datetime import datetime | |
| import pandas | |
| import random |
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
| # List all the tables using a profile | |
| aws dynamodb list-tables --profile <profile_name> | jq | |
| # Get all item in a table using a profile (expensive) | |
| aws dynamodb scan --table-name <table_name> --profile <profile_name> | jq | |
| # Get an specific item based on id using a profile | |
| aws dynamodb get-item --key '{"id":{"S":"009871"}}' --table-name <table_name> --profile <profile_name> | jq | |
| # Create an item using a profile |
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
| #!/bin/bash | |
| function delete_dynamodb() { | |
| echo "Deleting all DynamoDB table in ${region}" | |
| for table in $(aws dynamodb list-tables); do | |
| echo "Deleting ${table} DynamoDB table" | |
| aws dynamodb delete-table --table-name ${table} | |
| done | |
| } | |
| function delete_ecr() { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| """ | |
| This gist shows how to run asyncio loop in a separate thread. | |
| It could be useful if you want to mix sync and async code together. | |
| Python 3.7+ | |
| """ | |
| import asyncio | |
| from datetime import datetime | |
| from threading import Thread | |
| from typing import Tuple, List, Iterable |
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
| /* Useful celery config. | |
| app = Celery('tasks', | |
| broker='redis://localhost:6379', | |
| backend='redis://localhost:6379') | |
| app.conf.update( | |
| CELERY_TASK_RESULT_EXPIRES=3600, | |
| CELERY_QUEUES=( | |
| Queue('default', routing_key='tasks.#'), |
NewerOlder