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
service: fb-notification-service # Name of the service | |
useDotenv: true # We want to get the env variables from our .env | |
provider: | |
name: aws # provider we want to use | |
runtime: python3.8 # runtime we want to use // python3.9 does not work currently | |
memorySize: 128 # memory size, 128 is the lowest, scales performance | |
region: eu-central-1 | |
stage: ${opt:stage, 'production'} # is used in the name |
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 monitoring import api, crypto, webpage | |
from notifications import send_sms, send_email, send_to_slack | |
def run(): | |
# monitoring - uncomment the one you want to use | |
msg = api.check_exchange_rate() | |
# msg = crypto.check_available_mim() | |
# msg = webpage.find_add_to_cart_button() |
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 | |
import os | |
from dotenv import load_dotenv | |
from datetime import datetime | |
load_dotenv() | |
def send_sms(msg: str) -> None: | |
URL = os.getenv("SLACK_WEBHOOK") |
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 os | |
from twilio.rest import Client | |
from dotenv import load_dotenv | |
load_dotenv() | |
def send_sms(msg: str, recipient: str = None) -> None: | |
client = Client(os.getenv("TWILIO_SID"), os.getenv("TWILIO_AUTH")) | |
client.messages.create( |
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 os | |
import smtplib, ssl | |
from dotenv import load_dotenv | |
load_dotenv() # take environment variables from .env. | |
PORT = 465 | |
def send_email(msg: str, recipient: str = None) -> None: | |
email = os.getenv("EMAIL") |
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 json | |
from typing import Optional | |
import requests | |
URL = "https://api.avax.network/ext/bc/C/rpc" | |
# Payload retrieved from monitoring network calls when running `balanceOf` on this contract: | |
# https://snowtrace.io/address/0xf4f46382c2be1603dc817551ff9a7b333ed1d18f#readContract | |
# address 1 is the address of the MIM Token (0x130966628846bfd36ff31a822705796e8cb8c18d) |
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 typing import Optional | |
from bs4 import BeautifulSoup | |
import requests | |
URL = "https://www.everdrop.de/products/handburste-aus-fsc-zertifiziertem-buchenholz-und-pflanzlichen-borsten" | |
# URL = "https://www.everdrop.de/products/everdrop-glastiegel" (this one is available at time of writing) | |
def find_add_to_cart_button(url: str = None) -> Optional[str]: |
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 typing import Optional | |
from numbers import Number | |
from xml.dom.minidom import parseString | |
import requests | |
SETTINGS = { | |
"currency": "THB", | |
"threshold": 35, | |
"message": "The current exchange rate for EUR/{currency} is {value}", | |
} |
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 decimal import Decimal, localcontext | |
def solution(s): | |
n = Decimal(s) | |
with localcontext() as ctx: | |
ctx.prec = 102 | |
r = Decimal(2).sqrt() | |
s = Decimal(2) + Decimal(2).sqrt() | |
def solve(n): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder