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
#!/bin/bash | |
curl ipinfo.io/ip |
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
#installation | |
!pip install selenium | |
!apt-get update # to update ubuntu to correctly run apt install | |
!apt install chromium-chromedriver | |
!cp /usr/lib/chromium-browser/chromedriver /usr/bin | |
import sys | |
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') | |
from selenium import webdriver | |
chrome_options = webdriver.ChromeOptions() |
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
# install chromium, its driver, and selenium | |
!apt install chromium-chromedriver | |
!pip install selenium | |
!cp /usr/lib/chromium-browser/chromedriver /usr/bin | |
import sys | |
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') | |
# set options to be headless, .. | |
from selenium import webdriver | |
options = webdriver.ChromeOptions() | |
options.add_argument('--headless') |
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
#https://github.com/smithclay/lambdium/blob/master/template.yaml | |
AWSTemplateFormatVersion : '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: selenium with headless chromium | |
Resources: | |
DeploymentPermission: | |
Type: "AWS::Lambda::LayerVersionPermission" | |
Properties: | |
Action: lambda:GetLayerVersion | |
LayerVersionArn: !Ref ChromiumLayer |
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 avail.aws.cloudsearch import get_cloudsearch_endpoint_from_settings | |
import time | |
import json | |
def splitList(l,n): | |
x = [l[i:i + n] for i in range(0, len(l), n)] | |
return x | |
# get all items from dynamodb | |
import boto3 |
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
def splitList(l,n): | |
x = [l[i:i + n] for i in range(0, len(l), n)] | |
return x | |
splitList(l,n) |
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: | |
NotificationEmail: | |
Type: String | |
Resources: | |
CheckWebsitePeriodically: | |
Type: AWS::Serverless::Function | |
Properties: | |
Handler: LambdaFunctionOverHttps.handler |
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
myl=df.T.to_dict().values() |
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 boto3 | |
lambda_ = boto3.client('lambda', | |
aws_access_key_id = MY_ACCESS_KEY_ID, | |
aws_secret_access_key = MY_SECRET_ACCESS_KEY, | |
region_name = 'us-east-1' ) | |
response = lambda_.invoke( | |
FunctionName='arn:aws:lambda:us-east-1:xxxxxx', | |
InvocationType='RequestResponse', | |
LogType='Tail', | |
Payload= json.dumps({'test': 'testPayload'}) |
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
!pip install --quiet pynamodb | |
from pynamodb.models import Model | |
from pynamodb.attributes import UnicodeAttribute, JSONAttribute | |
class PynamoStocks(Model): | |
class Meta: | |
# aws_access_key_id = MY_ACCESS_KEY_ID | |
# aws_secret_access_key = MY_SECRET_ACCESS_KEY | |
table_name = 'tops-inv-backlog-2' | |
region = 'us-east-1' | |
billing_mode='PAY_PER_REQUEST' |
OlderNewer