Skip to content

Instantly share code, notes, and snippets.

@KarimullinArthur
KarimullinArthur / simpleRigistartion.py
Last active March 30, 2023 11:40
Ригистрация, учусь работать с БД
import sqlite3
conn = sqlite3.connect('date.db')
cur = conn.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS users(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
password TEXT);""")
conn.commit()
@KarimullinArthur
KarimullinArthur / random.py
Created April 17, 2022 16:59
Ну работает же, П.С little рандомер
import time
def random():
getTime = time.time()
randInt = getTime % 1
randInt = str(randInt)
@KarimullinArthur
KarimullinArthur / tmux-start
Last active July 24, 2023 14:59
потом сделаю целый манагер, но пока залью это, а то чёт теряется.
#!/bin/sh
session_name='project'
path=~/work/project
pg=project_db
set -euC
cd $path
att() {
@KarimullinArthur
KarimullinArthur / kbct.service
Last active July 23, 2023 18:19
kbct config file
[Unit]
Description=Rebind my keyboard via kbct
[Service]
Type=simple
ExecStart=sudo kbct remap --config /home/arthur/.config/kbct.yaml
Restart=always
[Install]
WantedBy=default.target

Настраиваем сервер

SSH ключи

Копируем публчиный ключ на сервер:

ssh-copy-id server

Добавляем ключ в authorizedkeys, чтобы не вводить пароль:

@KarimullinArthur
KarimullinArthur / habr_freelance_parser.py
Last active July 24, 2023 13:53
Habr Freelance Parser
import pprint
import requests
from bs4 import BeautifulSoup as bs
URL = 'https://freelance.habr.com/tasks'
categorie = '?categories=development_bots'
resp = requests.get(URL+categorie)
@KarimullinArthur
KarimullinArthur / loader.py
Created July 24, 2023 14:48
learn FastApi. Api send disk space info, update with cron.
# import uvicorn
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, log_level="info")
@KarimullinArthur
KarimullinArthur / create_bot.sh
Last active March 10, 2024 13:21
create bot on server (tmp)
#!/usr/bin/bash
ADMIN_USER=arthur
echo Bot Name
read name
useradd -s /bin/bash $name
mkdir /home/$name
@KarimullinArthur
KarimullinArthur / aiohttp_vs_requests.py
Created January 19, 2024 11:26
aiohttp_vs_requests.py
import aiohttp
import asyncio
import requests
import time
async def aio():
URL = 'https://cleanuri.com/api/v1/shorten'
links = ['https://artlin.codeberg.page/contacts.html'] * 10
@KarimullinArthur
KarimullinArthur / cbr_parser.py
Created April 10, 2024 08:20
Parser of rate from CBR
import bs4 as bs
import requests
URL = 'http://www.cbr.ru/scripts/XML_daily.asp?date_req='
def get_rate(code: str, date: str = '') -> float:
date = reversed(date.split('-'))
date = '/'.join(str(x) for x in date)