Skip to content

Instantly share code, notes, and snippets.

View suzzukin's full-sized avatar
💭
I may be slow to respond.

Artem suzzukin

💭
I may be slow to respond.
View GitHub Profile
@suzzukin
suzzukin / telethon_chat_management.py
Created February 16, 2022 21:20
telegram add or remove user from group
import os
import pandas as pd
import telethon as T
from telethon.sync import TelegramClient
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
from telethon.tl.functions.channels import InviteToChannelRequest
api_id = 324567127
api_hash = 'xxxxxxxxxxxxxxxxx'
phone = '+8801817xxxxx'
@suzzukin
suzzukin / basic.sh
Created February 16, 2022 21:19
linx
#!/bin/bash
sudo dpkg-reconfigure $(dpkg -l | awk '{print $2}'|grep "^roundcube"|tr '\n' ' ')
sudo apt-get update && apt-get upgrade -y
sudo apt-get install curl wget net-tools ethtool transmission build-essential python-pip python3-pip bash-completion -y
sudo apt-get install apt-transport-https libssl-dev libffi-dev python3-dev openvpn redsocks bridge-utils -y
sudo apt-get install python3-pip python3-dev
sudo apt-get install python3-venv -y
sudo apt-get install gcc make -y
sudo apt-get purge ufw* -y
sudo apt-get autoremove y
import unittest
def is_even(number):
''' Returns True if **number** is even or False if it is odd. '''
return number % 2
class TestUM(unittest.TestCase):
def test_is_boolean(self):
from bs4 import BeautifulSoup
import requests
import sys
class PythonCrawler:
def __init__(self, link):
self.headers = {
'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15'
}
from django.core import serializers
from django.htttp import JsonResponse
from django.db import models
class Product(models.Model):
categories = models.ManyToManyField(Category,
related_name='products',
blank=True, verbose_name=u"категории")
related_products = models.ManyToManyField('Product',
blank=True,