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 numpy as np | |
def lambda_handler(event, context): | |
input_array = np.array(event['array']) | |
num_dimensions = input_array.ndim | |
return num_dimensions |
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
pip install numpy -t deployment_package | |
cp lambda_handler.py deployment_package | |
(cd deployment_package && zip -r ../package.zip .) |
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 subprocess | |
import os | |
def run(command): | |
print(command) | |
process = subprocess.call(command, shell=True, cwd='/tmp/') | |
def lambda_handler(event, context): | |
GITHUB_EMAIL = os.environ['GITHUB_EMAIL'] | |
GITHUB_USERNAME = os.environ['GITHUB_USERNAME'] |
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 tensorflow as tf | |
def lambda_handler(event, context): | |
# Simple hello world using TensorFlow | |
hello = tf.constant('Hello, TensorFlow!') | |
# Start tf session | |
sess = tf.Session() | |
# Run the op |
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
from datadog import datadog_lambda_wrapper, statsd | |
import time | |
@datadog_lambda_wrapper | |
def lambda_handler(event, context): | |
x = event['x'] | |
y = event['y'] | |
z = event['z'] | |
start_time = time.time() | |
result = perform_complex_calculation(x, y, z) |
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 os | |
from botocore.vendored import requests | |
def get_stock_quote(symbol): | |
API_KEY = os.environ['API_KEY'] | |
response = requests.get(f'https://www.alphavantage.co/query?apikey={API_KEY}&function=GLOBAL_QUOTE&symbol={symbol}') | |
return response.json()['Global Quote'] | |
# get_stock_quote('AAPL') | |
# { |
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 os | |
from datadog import datadog_lambda_wrapper, lambda_metric | |
from botocore.vendored import requests | |
def get_stock_quote(symbol): | |
API_KEY = os.environs['API_KEY'] | |
response = requests.get(f'https://www.alphavantage.co/query?apikey={API_KEY}&function=GLOBAL_QUOTE&symbol={symbol}') | |
return response.json()['Global Quote'] | |
def track_metric(symbol, title, value): |
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
func (Foo) Write(p []byte) (n int, err error) { | |
panic("not implemented") // TODO: Implement | |
} | |
// Sum appends the current hash to b and returns the resulting slice. | |
// It does not change the underlying hash state. | |
func (Foo) Sum(b []byte) []byte { | |
panic("not implemented") // TODO: Implement | |
} |
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
// Len is the number of elements in the collection. | |
func (Foo) Len() int { | |
panic("not implemented") // TODO: Implement | |
} | |
// Less reports whether the element with | |
// index i should sort before the element with index j. | |
func (Foo) Less(i int, j int) bool { | |
panic("not implemented") // TODO: Implement | |
} |
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
//handle COM_INIT_DB command, you can check whether the dbName is valid, or other. | |
func (Foo) UseDB(dbName string) error { | |
panic("not implemented") // TODO: Implement | |
} | |
//handle COM_QUERY command, like SELECT, INSERT, UPDATE, etc... | |
//If Result has a Resultset (SELECT, SHOW, etc...), we will send this as the response, otherwise, we will send Result | |
func (Foo) HandleQuery(query string) (*server.Result, error) { | |
panic("not implemented") // TODO: Implement | |
} |
OlderNewer