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 appex | |
import json | |
import requests | |
LANGUAGE = "en-gb" | |
OXFORD_ID = "9acc1234" | |
OXFORD_KEY = "6baccf388cd6456456326e85054f30aba" | |
OXFORD_URL = "https://od-api.oxforddictionaries.com/api/v2" | |
OXFORD_HEADERS = { | |
"app_id": OXFORD_ID, |
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 datetime import datetime, timedelta | |
import boto3 | |
ACCOUNT_NUMBER = 1234567890 | |
MAX_DURATION = 129600 | |
NUM_DAYS = 30 | |
USER = "jitsejan" | |
# Prompt user for the MFA token |
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 smtplib | |
import ssl | |
import lxml.html | |
import requests | |
URL = "https://happiestbaby.co.uk/products/snoo-smart-bassinet" | |
resp = requests.get(URL) | |
tree = lxml.html.fromstring(resp.content) |
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 dataclasses import dataclass | |
import lxml.html | |
import requests | |
from typing import Iterator | |
BASE_URL = "https://zelda.gamepedia.com" | |
HEADERS = { | |
'User-Agent': 'Mozilla/5.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
import pandas as pd | |
import requests | |
JIRA_TOKEN = "abcdefg12345" | |
JIRA_URL = "https://jitsejan.atlassian.net/" | |
JIRA_USER = "[email protected]" | |
# Setup a requests session | |
rsession = requests.Session() | |
# New Jira instances authenticate through a token |
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 jupyter/pyspark-notebook | |
USER root | |
# Add essential packages | |
RUN apt-get update && apt-get install -y build-essential curl git gnupg2 nano apt-transport-https software-properties-common | |
# Set locale | |
RUN apt-get update && apt-get install -y locales \ | |
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ | |
&& locale-gen | |
# Add config to Jupyter notebook | |
COPY jupyter/jupyter_notebook_config.py /home/jovyan/.jupyter/ |
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
""" availabilitychecker.py """ | |
import boto3 | |
import requests | |
class AvailabilityChecker: | |
def __init__(self): | |
self.ssm_client = boto3.client("ssm") | |
self.session = requests.Session() |
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
""" Get the log events for a log group from CloudWatch """ | |
import boto3 | |
from datetime import datetime, timedelta | |
import pandas as pd | |
ACCOUNT = 'prod' | |
GROUP = '/aws/lambda/lambda-function-prod' | |
NUM_DAYS = 7 | |
START_TIME = int((datetime.now() - timedelta(days=NUM_DAYS)).timestamp()) |
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
# Note: make sure the Google Sheet is published to the web first | |
import boto3 | |
import json | |
import pandas as pd | |
import pyarrow | |
import requests | |
GOOGLE_URL = "https://spreadsheets.google.com/feeds/list/{key}/{worksheet}/public/full?alt={format}" | |
GOOGLE_SHEET_ID = '1234567-abcedf' | |
GOOGLE_SHEET_TITLE = 'My title' |
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 | |
import json | |
REGION = "eu-west-1" | |
ENV = "dev" | |
FUNCTION_NAME = 'lambda-function-name' | |
session = boto3.session.Session(profile_name=ENV) | |
lambda_client = session.client('lambda', REGION) |
NewerOlder