This workflow automatically checks for file updates by running a Python script and commits any changes to a separate branch.
- Scheduled: Every 30 minutes
- Manual: via
workflow_dispatch - Push: on the
mainbranch
| #!/bin/sh | |
| case "$reason" in | |
| BOUND|RENEW|STATIC) | |
| /usr/local/bin/send_ip_telegram.sh & | |
| ;; | |
| esac |
| export default { | |
| async fetch(request, env, ctx) { | |
| let url = new URL(request.url); | |
| url.hostname = url.hostname.replace(/\.?src\.com$/, '.dest.com'); | |
| let newHeaders = new Headers(request.headers); | |
| newHeaders.set('Host', url.hostname); | |
| let newRequest = new Request(url.toString(), { | |
| method: request.method, |
| from httpx import Client | |
| from bs4 import BeautifulSoup, Tag | |
| import re | |
| import json | |
| import os | |
| raw_course_urls: list[str] = [ | |
| "https://learn.astanait.edu.kz/courses/course-v1:AITU+KazHist01+24-25_C1_Y1/course/", |
| name: Deploy to Server | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest |
| import signal | |
| import os | |
| def sync() -> None: | |
| os.kill(os.getppid(), signal.SIGUSR1) | |
| def reload(*args) -> None: | |
| ... |
| from multiprocessing import cpu_count | |
| import subprocess | |
| import atexit | |
| bind = "127.0.0.1:8000" | |
| workers = 2 # cpu_count() * 2 + 1 | |
| worker_class = "sync" |
| from httpx import Client, ReadTimeout | |
| from itertools import cycle | |
| from collections import deque | |
| from math import modf | |
| from time import sleep | |
| BOT_TOKEN: str = "..." | |
| CHAT_ID: int = -100 |
| from typing import List | |
| def long_input(prompt: str) -> str: | |
| result: List[str] = [] | |
| print(prompt) | |
| while True: | |
| result_ = input() |
| from typing import Dict | |
| TEXTS: Dict[str, str] = { | |
| "start": "Hello {mention} 👋\n\nAsk me anything :)", | |
| "wait": "Wait please...", | |
| "error": "Something went wrong." | |
| } |