Skip to content

Instantly share code, notes, and snippets.

@KarimullinArthur
KarimullinArthur / binary_clock.py
Last active August 12, 2024 04:41
binary clock prototype 1
import datetime
import os
import time
while True:
print(str(datetime.datetime.now()).split(' ')[1].split('.')[0])
print(bin(int(str(datetime.datetime.now()).split(' ')[1].split('.')[0].split(':')[0])).split('b')[1].replace('1', '●').replace('0', '○'), end=':')
print(bin(int(str(datetime.datetime.now()).split(' ')[1].split('.')[0].split(':')[1])).split('b')[1].replace('1', '●').replace('0', '○'), end=':')
print(bin(int(str(datetime.datetime.now()).split(' ')[1].split('.')[0].split(':')[2])).split('b')[1].replace('1', '●').replace('0', '○'))
@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)
@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 / 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 / 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 / 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)

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

SSH ключи

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

ssh-copy-id server

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

@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
@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 / random.py
Created April 17, 2022 16:59
Ну работает же, П.С little рандомер
import time
def random():
getTime = time.time()
randInt = getTime % 1
randInt = str(randInt)