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 | |
def lambda_handler(event, context): | |
# TODO implement | |
print(event) | |
print(context) | |
VERIFY_TOKEN = "ABCD" | |
http_method = event.get("requestContext", {}).get("http", {}).get("method") | |
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 fastapi import FastAPI, Request, HTTPException | |
from pydantic import BaseModel | |
import json | |
import requests | |
app = FastAPI() | |
PAGE_ACCESS_TOKEN = "EAAF9uJKilGYBO3t81bXI6n2BpXZBbj1JoWbzyZCbcwqdtigTHAZCiUSHowMcTUETT2ZCgZAkyrJVIqMWS2ZBm7ZAnp6ihB31oZCGn2Vc9kBIKLlYg7c2uMQZC6mzsiFBYa9adX6lAfjWERhSDpNPf49potdyEDZAk4qtwZCDdCovA89sYPt2Hv9FYwXQpRHZCCpZAOIOYrdfSA56iiAZDZD" | |
VERIFY_TOKEN = "ABCDE" |
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 | |
# Read the Excel file | |
df = pd.read_excel('/content/datadict_khaodao.xlsx') | |
# Group the DataFrame by column 'A' | |
grouped = df.groupby('table_nm') | |
# Create a new Excel writer object | |
with pd.ExcelWriter('/content/output_file.xlsx') as writer: |
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 streamlit as st | |
import sqlite3 | |
import pandas as pd | |
from datetime import datetime, timedelta | |
# Function to calculate days left until a given date | |
def calculate_days_left(event_date): | |
current_date = datetime.now().date() | |
days_left = (event_date - current_date).days | |
return days_left |
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 pyautogui | |
import time | |
# Define the idle threshold in seconds | |
idle_threshold = 10 # Adjust as needed | |
idle_time = 0 | |
# Store the initial mouse position | |
prev_mouse_position = pyautogui.position() |
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 subprocess | |
from fastapi import FastAPI | |
app = FastAPI() | |
def run_command_in_folder(folder_path, command): | |
# Get the current working directory |
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 subprocess | |
import time | |
# Define the target server (e.g., Google's DNS server) | |
target_server = "8.8.8.8" | |
# Define the threshold for considering it as a drop-off (in milliseconds) | |
threshold_ms = 100 # Adjust this value as needed | |
def is_internet_up(): |
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 speedtest | |
def check_speed(): | |
st = speedtest.Speedtest() | |
download_speed = st.download() / 10**6 # Convert to Mbps | |
upload_speed = st.upload() / 10**6 # Convert to Mbps | |
print(f"Download Speed: {download_speed:.2f} Mbps") | |
print(f"Upload Speed: {upload_speed:.2f} Mbps") |
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 | |
from pprint import pprint | |
start_date_input=input("Please provide start date in this format(Oct 10 2023). \n>>> ") | |
start_date = datetime.strptime(start_date_input, "%b %d %Y") | |
timeline = {} | |
temp = start_date | |
for week in list(range(1,9)): |
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 -x | |
VERBOSE=0 | |
OS_NAME= | |
OS_VERSION= | |
OS_CODE_NAME= | |
ARCH= | |
export IP= | |
export DEBIAN_FRONTEND=noninteractive | |
[[ -z "$CREATE_AMI" ]] && export CREATE_AMI |
NewerOlder