Skip to content

Instantly share code, notes, and snippets.

View sergeyk's full-sized avatar

Sergey Karayev sergeyk

View GitHub Profile
@tomfa
tomfa / handler.py
Last active February 14, 2023 15:08
AWS Lambda: Python store to S3
# This file is your Lambda function
import json
import boto3
def save_to_bucket(event, context):
AWS_BUCKET_NAME = 'my-bucket-name'
s3 = boto3.resource('s3')
bucket = s3.Bucket(AWS_BUCKET_NAME)
path = 'my-path-name.txt'
@andrewgiessel
andrewgiessel / pytables_numpy.py
Last active January 7, 2020 18:17
simple example to use pytables to save a numpy array
import tables
import numpy as np
# Store "all_data" in a chunked array...
# from: http://stackoverflow.com/questions/8843062/python-how-to-store-a-numpy-multidimensional-array-in-pytables
f = tables.openFile('all_data.hdf', 'w')
atom = tables.Atom.from_dtype(all_data.dtype)
filters = tables.Filters(complib='blosc', complevel=5)
ds = f.createCArray(f.root, 'all_data', atom, all_data.shape, filters=filters)