Skip to content

Instantly share code, notes, and snippets.

View arynyklas's full-sized avatar
🏠
Working from home

Aryn arynyklas

🏠
Working from home
View GitHub Profile
@arynyklas
arynyklas / README.md
Last active February 20, 2025 17:40
Github Actions Workflow to track updates of files in data folder

Check files updates workflow

This workflow automatically checks for file updates by running a Python script and commits any changes to a separate branch.

Triggers

  • Scheduled: Every 30 minutes
  • Manual: via workflow_dispatch
  • Push: on the main branch

Steps

@arynyklas
arynyklas / 99-send-ip-to-telegram
Last active February 16, 2025 10:55
Send IP to Telegram using Bot API as soon as internet connection established & make SSH tunnel
#!/bin/sh
case "$reason" in
BOUND|RENEW|STATIC)
/usr/local/bin/send_ip_telegram.sh &
;;
esac
@arynyklas
arynyklas / cf_proxy_worker.js
Last active March 11, 2025 23:13
Cloudflare Worker to use domain as a proxy to another domain
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,
@arynyklas
arynyklas / learn_parser.py
Last active November 18, 2024 17:42
learn.astanait.edu.kz parser; paste your cookies from website to `cookies.txt`
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/",
@arynyklas
arynyklas / deploy.yml
Created November 7, 2024 12:01
Auto deploy application using Github Workflow
name: Deploy to Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
@arynyklas
arynyklas / main.py
Last active November 4, 2024 14:46
Share signal via gunicorn workers
import signal
import os
def sync() -> None:
os.kill(os.getppid(), signal.SIGUSR1)
def reload(*args) -> None:
...
@arynyklas
arynyklas / gunicorn_config.py
Last active October 29, 2024 18:58
Run FastAPI with Gunicorn (as a service) through Nginx
from multiprocessing import cpu_count
import subprocess
import atexit
bind = "127.0.0.1:8000"
workers = 2 # cpu_count() * 2 + 1
worker_class = "sync"
@arynyklas
arynyklas / main.py
Last active December 10, 2023 11:11
@whale's live wins
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()
@arynyklas
arynyklas / basic_data.py
Last active March 15, 2023 18:08
Python aiogram 3.0.07b multibot to communicate with OpenAI's text-davinci-003 AI
from typing import Dict
TEXTS: Dict[str, str] = {
"start": "Hello {mention} 👋\n\nAsk me anything :)",
"wait": "Wait please...",
"error": "Something went wrong."
}