Skip to content

Instantly share code, notes, and snippets.

View supreme-core's full-sized avatar
:octocat:

I am me supreme-core

:octocat:
View GitHub Profile
@supreme-core
supreme-core / zshaws.sh
Created February 10, 2024 04:18 — forked from kidd/zshaws.sh
#!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 () {
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
@supreme-core
supreme-core / data-insert.py
Created February 8, 2024 03:46 — forked from kojiisd/data-insert.py
DynamoDBのCapacityUnitsの実際の使用量を割合で出力する ref: https://qiita.com/kojiisd/items/c7f0fe22e1353eecb909
import sys
import csv
import math
from decimal import Decimal
from time import sleep
from datetime import datetime
import pandas
import random
@supreme-core
supreme-core / aws_dynamo_101.sh
Created February 8, 2024 03:46 — forked from necronet/aws_dynamo_101.sh
An easy example of some aws console operation for dynamodb
# 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
@supreme-core
supreme-core / aws_delete_resource.sh
Created February 8, 2024 03:45 — forked from VMuliadi/aws_delete_resource.sh
Bash script to delete all resouce from AWS.
#!/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() {
@supreme-core
supreme-core / py38-success.ipynb
Created August 28, 2023 22:30 — forked from ngrislain/py38-success.ipynb
py38 success.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@supreme-core
supreme-core / asyncio_loop_in_thread.py
Created August 2, 2023 18:31 — forked from dmfigol/asyncio_loop_in_thread.py
Python asyncio event loop in a separate thread
"""
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
@supreme-core
supreme-core / celery.sh
Created March 13, 2022 00:45 — forked from amatellanes/celery.sh
Celery handy commands
/* 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.#'),