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) |
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
""" 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
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 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
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 = "mail@jitsejan.com" | |
# 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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import matplotlib.style as style | |
import seaborn as sns | |
plt.rcParams["figure.figsize"] = (12,12) | |
# Improve style of the plots | |
style.use('seaborn-deep') | |
style.use('ggplot') |
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 azure.storage.blob import BlockBlobService | |
import pandas as pd | |
import pyarrow.parquet as pq | |
from io import BytesIO | |
from configparser import RawConfigParser | |
from pyspark import SparkConf, SparkContext, SQLContext | |
CONTAINER_NAME = "userjj" | |
BLOB_NAME = "characters.parquet" |