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
name: Deploy Python Lambda | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.py' # Change to the file extension of the language that you are using. | |
jobs: |
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 extract_names(json_obj, name = "root"): | |
names = [] | |
if isinstance(json_obj, dict): | |
if "name" in json_obj: | |
name = json_obj["name"] | |
names.append(json_obj["name"]) | |
for key, value in json_obj.items(): | |
names.extend(extract_names(value, name=name)) | |
elif isinstance(json_obj, list): | |
for item in json_obj: |
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 json | |
import boto3 | |
from PIL import Image | |
import pathlib | |
import urllib | |
# Read from environmental variables | |
ID = os.environ['AWS_ID'] | |
KEY = os.environ['AWS_KEY'] |
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 zipfile | |
import glob | |
from pathlib import Path | |
import urllib | |
import pandas as pd | |
zip_path = "/home/user/files/zip" | |
xlsx_path = "/home/user/files/xlsx" | |
csv_path = "/home/user/files/csv" | |
file_name = "downloaded.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
import pickle | |
from datetime import datetime | |
def predict_recaudacion(feature_1_date: str, feature_2: float, feature_3: float, feature_4: float): | |
week_day, month = transform_date_inputs(feature_1_date) | |
# Load model | |
model_file = 'model.sav' | |
loaded_model = pickle.load(open(model_file, 'rb')) | |
# Load scaler | |
scaler_file = 'scaler.pkl' |
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 itertools | |
from datetime import datetime, timedelta | |
import urllib.request | |
url_base = "https://www.web.es/f/files/Press%20notes/PRESS_NOTE_DATE_{0}.pdf" #EXAMPLE (Change it) | |
def check_if_url_exists(url): | |
try: | |
request = urllib.request.Request(url) |
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 pywinauto | |
import pyperclip | |
def get_two_factor_widget_app(path_to_widget_app): | |
try: | |
app2 = pywinauto.Application().connect(path=path_to_widget_app) | |
except pywinauto.application.ProcessNotFoundError as ex: | |
print("2-factor process not found. Launching it...") | |
pywinauto.Application().start(path_to_widget_app) | |
app2 = pywinauto.Application().connect(path=path_to_widget_app) |
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 pywinauto | |
def cancel_and_connect_to_VPN(app): | |
try: | |
app['Pulse Secure']['Cancel'].click() | |
time.sleep(5) | |
print("Application canceled, clicking in Connect...") | |
app['Pulse Secure']['Connect'].click() | |
except pywinauto.MatchError as me: | |
print("Cancel button doesn't exist. Clicking in Connect...") | |
app['Pulse Secure']['Connect'].click() |
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 pywinauto | |
import time | |
import pyperclip | |
import subprocess | |
from pywinauto import Desktop | |
from datetime import datetime | |
import warnings | |
warnings.simplefilter('ignore', category=UserWarning) # Ignore pywinauto warnings | |
# https://github.com/pywinauto/pywinauto/issues/530 |
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 telegram | |
import time | |
import traceback | |
bot = telegram.Bot(token=TELEGRAM_TOKEN) | |
def send_to_telegram(message, group_id=TELEGRAM_METRICS_GROUP_ID): | |
""" |
NewerOlder