This file contains 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 pandas import read_csv | |
# Enter path to file here | |
fname = '' | |
def convert_to_floats(col): | |
return col.apply(lambda x: float(x.replace(',', '')) if x != '' else 0) |
This file contains 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
AWSTemplateFormatVersion: 2010-09-09 | |
Transform: AWS::Serverless-2016-10-31 | |
Parameters: | |
VpcId: | |
Type: String | |
Description: The ID of the VPC containing the EC2 instance | |
InstanceAZ: |
This file contains 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
DOMAIN= # insert your domain here (e.g. example.com) | |
STACK= # choose a name for your stack | |
REGION=us-east-1 # the ACM certificate must be in us-east-1 | |
aws cloudformation deploy --template-file https_s3_website.yaml \ | |
--stack-name $STACK \ | |
--region $REGION \ | |
--parameter-overrides DomainName=$DOMAIN | |
# push the website source to the s3 bucket - assuming it is contained in src/ |
This file contains 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
LAYER_NAME=NltkPunkt | |
REGION=us-east-1 | |
mkdir -p build/nltk_punkt/python | |
docker run -v $(pwd):/out lambci/lambda:build-python3.7 /bin/bash -c \ | |
"pip install nltk -t /out/build/nltk_punkt/python; | |
cd /out/build/nltk_punkt/python; | |
python -c \"import nltk; nltk.download('punkt', '/out/build/nltk_punkt/python')\"; | |
rm tokenizers/punkt.zip; |
This file contains 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 boto3 import resource | |
OLD_TABLE = '' | |
NEW_TABLE = '' | |
OLD_REGION = '' | |
NEW_REGION = '' | |
def put_new_items(response, newTable): |
This file contains 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 requests | |
from time import sleep, time | |
from boto3 import Session | |
from requests_aws4auth import AWS4Auth | |
OLD_ES_ENDPOINT = '' | |
NEW_ES_ENDPOINT = '' | |
INDEX = '' # e.g. 'index1', or 'index1,index2,index3', or '*' |
This file contains 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
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
ApiId: | |
Type: String | |
Description: The ID of the API for which to create the custom domain | |
ApiStage: | |
Type: String |
This file contains 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
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
ApiId: | |
Type: String | |
Description: The ID of API to which this endpoint should be added | |
FunctionArn: | |
Type: String |
This file contains 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
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
ApiId: | |
Type: String | |
UsagePlanName: | |
Type: String | |
Description: >- |
This file contains 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
REGION=eu-west-1 | |
VER=1.7.3 | |
RUNTIME=python3.7 | |
docker run -v $(pwd):/out -it lambci/lambda:build-$RUNTIME \ | |
pip install scrapy==$VER -t /out/build/scrapy/python | |
cd build/scrapy | |
zip -r ../../scrapy.zip python/ | |
cd ../.. |
OlderNewer