- 1
- 2
- 3
- 4
- 5
- 6
- 7
temp = (NODE *)malloc(sizeof(NODE));
if (temp == NULL)
{
Free(temp);
Free(task);
return NULL;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+129
temp = (NODE *)malloc(sizeof(NODE));
if (temp == NULL)
{
Free(temp);
Free(task);
return NULL;
}
Курсовик ночью по пьяни. Подстраховался блин.
+124
;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;; Copyright (C) 2011, Dmitry Ignatiev <[email protected]>
;;; Permission is hereby granted, free of charge, to any person
;;; obtaining a copy of this software and associated documentation
;;; files (the "Software"), to deal in the Software without
;;; restriction, including without limitation the rights to use, copy,
;;; modify, merge, publish, distribute, sublicense, and/or sell copies
;;; of the Software, and to permit persons to whom the Software is
;;; furnished to do so, subject to the following conditions:
;;; The above copyright notice and this permission notice shall be
;;; included in all copies or substantial portions of the Software.
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
;;; DEALINGS IN THE SOFTWARE
(in-package #:neural-flow)
;; Stolen from `trivial-garbage'
#+openmcl
(defvar *weak-pointers* (cl:make-hash-table :test 'eq :weak :value))
#+(or allegro openmcl lispworks)
(defstruct (weak-pointer (:constructor %make-weak-pointer))
#-openmcl pointer)
(declaim (inline make-weak-pointer))
(defun make-weak-pointer (object)
#+sbcl (sb-ext:make-weak-pointer object)
#+(or cmu scl) (ext:make-weak-pointer object)
#+clisp (ext:make-weak-pointer object)
#+ecl (ext:make-weak-pointer object)
#+allegro
(let ((wv (excl:weak-vector 1)))
(setf (svref wv 0) object)
(%make-weak-pointer :pointer wv))
#+openmcl
(let ((wp (%make-weak-pointer)))
(setf (gethash wp *weak-pointers*) object)
wp)
#+corman (ccl:make-weak-pointer object)
#+lispworks
(let ((array (make-array 1)))
(hcl:set-array-weak array t)
(setf (svref array 0) object)
(%make-weak-pointer :pointer array)))
(declaim (inline weak-pointer-value))
(defun weak-pointer-value (weak-pointer)
"If WEAK-POINTER is valid, returns its value. Otherwise, returns NIL."
#+sbcl (values (sb-ext:weak-pointer-value weak-pointer))
#+(or cmu scl) (values (ext:weak-pointer-value weak-pointer))
#+clisp (values (ext:weak-pointer-value weak-pointer))
#+ecl (values (ext:weak-pointer-value weak-pointer))
#+allegro (svref (weak-pointer-pointer weak-pointer) 0)
#+openmcl (values (gethash weak-pointer *weak-pointers*))
#+corman (ccl:weak-pointer-obj weak-pointer)
#+lispworks (svref (weak-pointer-pointer weak-pointer) 0))
;;Red-black tree
(declaim (inline %node %nleft %nright %nparent %nred %ndata %ncode
(setf %nleft) (setf %nright) (setf %nparent)
(setf %nred) (setf %ndata) (setf %ncode)))
(defstruct (%node (:constructor %node (data code parent red))
(:conc-name %n))
(left nil :type (or null %node))
(right nil :type (or null %node))
(parent nil :type (or null %node))
(red nil)
data
(code 0 :type (integer 0 #.most-positive-fixnum)))
(declaim (inline %tree %tree-root (setf %tree-root)))
(defstruct (%tree (:constructor %tree ())
(:copier %copy-tree))
(root nil :type (or null %node)))
(declaim (inline rotate-left))
(defun %rotate-left (tree node)
(declare (type %tree tree) (type %node node)
(optimize (speed 3) (safety 0)))
(let ((right (%nright node)))
(when (setf (%nright node) (%nleft right))
(setf (%nparent (%nleft right)) node))
(if (setf (%nparent right) (%nparent node))
(if (eq node (%nleft (%nparent node)))
(setf (%nleft (%nparent node)) right)
(setf (%nright (%nparent node)) right))
(setf (%tree-root tree) right))
Вылезли глаза! Как на этом можно писать?
+161
// START MY FOR MENU
$list_pages = preg_replace('/<li([^>]*)>/is', ' ', $output);
$list_pages = str_replace('</li>', '', $list_pages);
$list_pages = preg_replace('/<a/is', '</td><td class="menu"> <a$1', $list_pages);
if (isset($_GET['page_id']) AND !is_numeric($_GET['page_id'])) { exit("ERROR!"); }
$pd = mysql_real_escape_string($_GET['page_id']);
if(strstr($_SERVER['REQUEST_URI'], 'page_id='.$pd) == TRUE) {
$list_pages = preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(http:\/\/'.$_SERVER["HTTP_HOST"].'\/\?page_id='.$pd.')/is', '</td><td class="menu_click"><a href="$1', $list_pages);
}
for($i=0; $i<sizeof($pages); $i++) {
$link = $pages[$i]->guid;
$lol = '';
if(strstr($_SERVER['REQUEST_URI'], '?') == TRUE) {
if ($link == 'http://'.$_SERVER['HTTP_HOST'].'/?'.$_SERVER['QUERY_STRING']) {
$list_pages = preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(http:\/\/'.$_SERVER["HTTP_HOST"].'\/\?'.$_SERVER["QUERY_STRING"].')/is', '</td><td class="menu_click2"><a href="$1', $list_pages);
}
} else {
if ($link == 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) {
$list_pages = preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(http:\/\/'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"].')/is', '</td><td class="menu_click2"><a href="$1', $list_pages);
}
}
}
$output = $list_pages;
$str = preg_split("/<\/a\>/i", $output);
$moar = '';
for ($i=0; $i<sizeof($pages); $i++)
{
$moar .= preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(.*)\" title=\"(.*)\">/is',
'</td><td class="menu" onclick="linkgo(\'$1\');" id="moar'.$i.'" onmouseover="menu1(\'moar'.$i.'\');" onmouseout="menu2(\'moar'.$i.'\');"> <a href="$1" title="$2">', $str[$i]);
$moar .= "</a>";
}
$output = $moar;
// END MY FOR MENU
None ;)
+155
<?php
$url = $_GET['url'];
$url = str_replace('http://', '', $url);
echo '<a href="http://$url">123</a>';
?>
+145
public double FindMax(double num1, double num2, double num3)
{
double max = num1;
if (num2 > max)
{
max = num2;
}
if (num3 > max)
{
max = num3;
}
return max;
}
+161
width ? width-- : width;
height ? height-- : height;
Ахуй нехуевый. Не говнокод, наверно, но всё же.
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:
−1
#include <iostream>
#include <string>
using namespace std;
struct A
{
uint16_t n;
uint8_t a1:1;
uint8_t a2:1;
uint8_t a3:1;
uint8_t a4:1;
uint8_t a5:4;
uint8_t b;
} __attribute__((packed));
int main()
{
char v[] = { 0x1, 0x1, 0b01010011, 0x9 };
A *p = (A*)v;
cout << (uint16_t)p->a1 << endl;
cout << (uint16_t)p->a2 << endl;
cout << (uint16_t)p->a3 << endl;
cout << (uint16_t)p->a4 << endl;
cout << (uint16_t)p->a5 << endl;
cout << (uint16_t)p->b << endl;
}
http://cpp.sh/6e5myf
Битовые поля неправильно считываются.
0
> https://habr.com/ru/post/518308/
> Мне надоело, что индустрия зависит от прихоти создателей языков программирования. Сообществу нужно больше власти
> В языках вечно не хватает чего-то простого — лямбда-функций,
> именованных объединений, кастомных примитивных типов. Я лезу
> в обсуждения на Stack Overflow, в Github и вижу, как разрабы жалуются
> — им не хватает того же, чего и мне. Но обсуждения почти всегда
> заканчиваются одинаково: нужная фича не появится, потому что
> главный дизайнер языка и члены его команды нужной ее не считают.
Именно поэтому я за Си. Хорошо что есть крестопарашная помойка, в которую дизайнеры языка добавляют всякую хуйню по желанию каждого встречного и поперечного. Если б такого не было, всю эту поебень пытались бы пропихнуть в Си. Так что от крестопараши определенно есть какая-то польза.
0
// sorry, I don't want to use any JS templater
// so I'll concatenate html as strings, which is the worst practice
// but my IntelliJ IDEA highlights html in strings well :)
// and I write this code just4fun
//
// but to respect production I'll leave here something that will never be fixed
// TODO: rewrite in Angular.js
//
// done!
// ...
// u still read this spaghetti?
let evaluate = (s) => {
completion = [];
hist = [];
let tokens = s.split(' ').filter((s) => s !== '');
if (!tokens[0]) return;
histfile.push(s);
if (tokens[0] === 'clear') clear();
else if (tokens[0] === 'aplay') aplay();
else if (tokens[0] === 'man') try {
template(tokens.slice(0, 2).join('_'))();
} catch {
stdout('No manual entry for <span class="red">' + tokens[1] + '</span>')
}
Сайт-визитка на plain js для подкаста в виде эмулятора терминала с пасхалками
https://deveeps.prost.host/