This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |