- 1
IT Оффтоп #87
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
IT Оффтоп #87
#57: https://govnokod.ru/26890 https://govnokod.xyz/_26890
#58: https://govnokod.ru/26916 https://govnokod.xyz/_26916
#59: https://govnokod.ru/26934 https://govnokod.xyz/_26934
#60: https://govnokod.ru/26949 https://govnokod.xyz/_26949
#61: https://govnokod.ru/26980 https://govnokod.xyz/_26980
#62: https://govnokod.ru/26999 https://govnokod.xyz/_26999
#63: https://govnokod.ru/27004 https://govnokod.xyz/_27004
#64: https://govnokod.ru/27020 https://govnokod.xyz/_27020
#65: https://govnokod.ru/27027 https://govnokod.xyz/_27027
#66: https://govnokod.ru/27040 https://govnokod.xyz/_27040
#67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
#68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
#69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
#70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
#71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
#72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
#73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
#74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
#75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
#76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
#77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
#78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
#79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
#80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
#81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
#82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
#83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
#84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
#85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
#86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
0
enum En {
A,
B,
C,
D = 4200,
E,
}
enum En2 {
D0 = En.D,
D1,
D2 = 1,
}
function main()
{
const a = En.A;
print (a, En.B, En.C, En.D);
print (En2.D0, En2.D1, En2.D2);
}
output: >>
0 1 2 4200
4200 1 1
Ну что.. учись "С" как enum-ы делать надо....
+2
Inductive my_bool :=
| my_false
| my_true.
Theorem shit_happens:
(if my_false then 42 else 100500) = 42.
Proof.
reflexivity.
Qed.
Какая типизация )))
0
from colorama import init, Fore, Back, Style
init()
print(Back.BLACK)
print(Fore.RED)
print(Style.NORMAL)
print("Script mamoeba/Скрипт сделан")
print("┌────────────────────────────────────┐")
print("│Author : GovnoCode user │")
print("│Github : https://:/│")
print("└────────────────────────────────────┘")
print("YouTube: utube")
print("▄▀▄ █▄░▄█ ▀ █▄░█ ▄▀▄ ▄▀▄ █▀▄ ▐▌░▐▌ █▀▄ ▄▀▄")
print("█▀█ █░█░█ █ █░▀█ █░█ █▀█ █░█ ░▀▄▀░ █▀█ █░█")
print("▀░▀ ▀░░░▀ ▀ ▀░░▀ ░▀░ ▀░▀ ▀▀░ ░░▀░░ ▀▀░ ░▀░")
print("Advertise Bot Amino")
lz = []
from concurrent.futures import ThreadPoolExecutor
import concurrent.futures
import amino
def advertise(data):
listusers = []
for userId in data.profile.userId:
listusers.append(userId)
return listusers
email = input("Email/Почта: ")
password = input("Password/Пароль: ")
msg = input("Message/Сообщение: ")
client = amino.Client()
client.login(email=email, password=password)
clients = client.sub_clients(start=0, size=1000)
for x, name in enumerate(clients.name, 1):
print(f"{x}.{name}")
communityid = clients.comId[int(input("Выберите сообщество/Select the community: "))-1]
sub_client = amino.SubClient(comId=communityid, profile=client.profile)
users = sub_client.get_online_users(size=1000)
user = advertise(users)
for i in lz:
if i in user:
user.remove(i)
print("Sending Advertise")
for _ in range(4000):
with concurrent.futures.ThreadPoolExecutor(max_workers=40000) as executor:
_ = [executor.submit(sub_client.start_chat, user, msg) for userId in user]
print("Sending Advertise 2")
for _ in range(4000):
with concurrent.futures.ThreadPoolExecutor(max_workers=40000) as executor:
0
function main()
{
let a: [string, number] = ["asd", 1.0];
print(a[0], a[1]);
const b: [string, number] = ["asd", 1.0];
print(b[0], b[1]);
const c = ["asd", 1.0];
print(c[0], c[1]);
}
Продолжаем будни говнописания говнокомпилятора. Хотел спросить а ваш компилятор может так, но думаю может. В кратце - это работа с таплами(tuples) а не с масивами :)
0
struct X {
int x;
int y;
X(int y_) :
y(y_),
x(y + 10)
{
}
};
int main()
{
X foo = X(16);
std::cout << "foo == (" << foo.x << ", " << foo.y << ")" << std::endl;
}
0
// Приведение численного типа к структуре с битовыми полями
template <class STRUCT_T, typename T>
STRUCT_T struct_cast(const T n)
{
static_assert(std::is_integral<T>::value, "Integral type required as T");
static_assert(std::is_class<STRUCT_T>::value, "class or struct type required as STRUCT_T");
static_assert(sizeof(T) == sizeof(STRUCT_T), "Incompatible types passed");
return *(reinterpret_cast<const STRUCT_T*>(&n));
}
// Приведение структур с битовыми полями к численному типу
template <typename T, class STRUCT_T>
T integral_cast(const STRUCT_T& s)
{
static_assert(std::is_integral<T>::value, "Integral type required as T");
static_assert(std::is_class<STRUCT_T>::value, "class or struct type required as STRUCT_T");
static_assert(sizeof(T) == sizeof(STRUCT_T), "Incompatible types passed");
return *(reinterpret_cast<const T*>(&s));
}
Почему это UB?
+2
<?php
function syoma_verify_spam($comment_post_ID) {
// NOTE: На telegram этот метод не вызывается
$content = trim($_POST['comment']);
if (preg_match('#<a href=#', $content) && !preg_match('#\[code#', $content)) {
die('Ня, пока.');
}
$content = strip_tags(apply_filters('gk_content', $content));
$content = strtr($content, array(
'A' => 'А',
'a' => 'а',
'B' => 'В',
'E' => 'Е',
'e' => 'е',
'3' => 'З',
'K' => 'К',
'k' => 'к',
'M' => 'М',
'H' => 'Н',
'O' => 'О',
'o' => 'о',
'P' => 'Р',
'p' => 'р',
'C' => 'С',
'c' => 'с',
'T' => 'Т',
'Y' => 'У',
'y' => 'у',
'X' => 'Х',
'x' => 'х',
'b' => 'ь',
));
$content = mb_strtolower($content);
if (preg_match('#русня|хуйло|ватник|ватный|пидораш|пидорах#', $content)) {
die('Рус-ня, пока.');
}
}
Угадайте, почему фильтрация <a href не в конце функции?
0
Нужно реализовать thread-safe set.
На сколько нормально разбить сет на N бакетов (по хешу, условно, 10000 штук),
тогда при добавлении или удалении элемента делать лок соответствующего бакета
Но будет хуево, когда пойдут запросы по одному ключу в нескольких тредах.
Есть решение лучше?
+2
#include <stdio.h>
#include <stdlib.h>
#define RW(a, c) for(src = (a);src < (c); src++, dst++){*dst=*src;}
void *pairscan(char *p)
{
size_t p_count = 1;
do {
if(*p == 'P') {
p_count++;
}
else {
p_count--;
}
p++;
} while(p_count != 0);
return p;
}
void rewrite(char *src, char *dst)
{
int p_r = 0;
while(*src == 'P') {
*dst = *src;
src++; dst++;
if (p_r < 3)
{
p_r++;
}
}
if(*src == 'I') {
if(p_r < 1) {
while(*src != 0) {
*dst = *src;
src++; dst++;
}
*dst = 0;
return;
}
dst--;
src++;
//src = pairscan(src+1);
while(*src != 0) {
*dst = *src;
src++; dst++;
}
*dst = 0;
return;
}
if(*src == 'K') {
if(p_r < 2)
{
while(*src != 0) {
*dst = *src;
src++; dst++;
}
*dst = 0;
return;
}
dst-=2;
char *exp1 = pairscan(src+1);
char *exp2 = pairscan(exp1);
RW(src+1,exp1);
for(; src < exp2; src++){}
while(*src != 0) {
*dst = *src;
src++; dst++;
}
*dst = 0;
return;
}
if(*src == 'S') {
if(p_r < 3) {
while(*src != 0){
*dst = *src;
src++; dst++;
}
*dst = 0;
return;
}
dst-=1;
char *exp1 = pairscan(src+1);
char *exp2 = pairscan(exp1);
char *exp3 = pairscan(exp2);
RW(src+1,exp1);
RW(exp2,exp3);
*dst = 'P';
dst++;
RW(exp1,exp2);
RW(exp2,exp3);
while(*src != 0) {
*dst = *src;
src++; dst++;
}
*dst = 0;
return;
}
*dst = 0;
return;
}
Кобенаторная логика
SKI combinator calculus