- 1
[color=green][s][u][b][size=20]ДАВАЙТЕ ФЛУДИТЬ И ТРОЛЛИТЬ[/size][/color][/b][/u][/s]
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
[color=green][s][u][b][size=20]ДАВАЙТЕ ФЛУДИТЬ И ТРОЛЛИТЬ[/size][/color][/b][/u][/s]
ДАВАЙТЕ ФЛУДИТЬ И ТРОЛЛИТЬ
−1
TServerThread = class(TThread)
private
procedure DoReadData;
protected
ThreadOwner: TIPCServer;
procedure Execute; override;
constructor Create(AThreadOwner: TIPCServer);
destructor Destroy; override;
public
end;
Мы кодили, кодили и наконец накодили!
0
<!DOCTYPE html>
<html>
<head>
<?php
$filename = 'mes.txt';
$count = "count.txt";
$count_file = fopen($count, "r");
$handle = fopen($filename, "rb");
date_default_timezone_set('Europe/Moscow');
$contents = file_get_contents($filename);
$contents2=nl2br($contents);
$password=htmlspecialchars($_POST["pass"]);
if($password=='dfhsdhf' || $password=='eeeeeer')
{
}
else
{
echo '403';
exit;
}
if( isset( $_POST['obn'] ) )
{
fclose($count_file);
$count_file = fopen($count, "w");
fwrite($count_file, '0');
echo "Обнулено";
$date = date("Y-m-d H:i:s");
$date_file = fopen("date.txt", "w");
fwrite($date_file, "$date");
}
?>
<title>Admin panel</title>
</head>
<body>
<h1>Начиная с <div id=date><?php echo file_get_contents("date.txt") ?></div> сайте было <div id=count><?php echo file_get_contents("count.txt") ?></div> людей</h1>
<p><?php if ($password == 'dfhsdhf')
echo "$contents2";
?>
</p>
<br>
<?php if ($password != 'dfhsdhf')
exit;
?>
<form method="POST">
<p>Введите код подтверждения</p>
<input type="password" name="pass">
<input type="submit" name="obn" value="Обнулить" />
</form>
</body>
</html>
Лучшая админка на php
+2
if hasattr(query, "items"):
query = query.items()
else:
# It's a bother at times that strings and string-like objects are
# sequences.
try:
# non-sequence items should not work with len()
# non-empty strings will fail this
if len(query) and not isinstance(query[0], tuple):
raise TypeError
# Zero-length sequences of all types will get here and succeed,
# but that's a minor nit. Since the original implementation
# allowed empty dicts that type of behavior probably should be
# preserved for consistency
except TypeError:
ty, va, tb = sys.exc_info()
raise TypeError("not a valid non-string sequence "
"or mapping object").with_traceback(tb)
https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L848
Зачем генерировать TypeError, а потом ее ловить и снова кидать?
0
void DrawLine(Vec2Si32 a, Vec2Si32 b, Rgba color_a, Rgba color_b) { // https://pastebin.com/p26FvZdd
Vec2Si32 ab = b - a;
Vec2Si32 abs_ab(std::abs(ab.x), std::abs(ab.y));
if (abs_ab.x >= abs_ab.y) {
if (a.x > b.x) {
DrawLine(b, a, color_b, color_a);
} else {
Sprite back = GetEngine()->GetBackbuffer();
Vec2Si32 back_size = back.Size();
if (ab.x == 0) {
if (a.x >= 0 && a.x < back_size.x &&
a.y >= 0 && a.y < back_size.y) {
back.RgbaData()[a.x + a.y * back.StridePixels()] = color_a;
}
return;
}
Si32 x1 = std::max(0, a.x);
Si32 x2 = std::min(back_size.x - 1, b.x);
Si32 y1 = a.y + ab.y * (x1 - a.x) / ab.x;
Si32 y2 = a.y + ab.y * (x2 - a.x) / ab.x;
if (y1 < 0) {
if (y2 < 0) {
return;
}
// lower left -> upper right
y1 = 0;
x1 = a.x + ab.x * (y1 - a.y) / ab.y;
x1 = std::max(0, x1);
} else if (y1 >= back_size.y) {
if (y2 >= back_size.y) {
return;
}
// upper left -> lower right
y1 = back_size.y - 1;
x1 = a.x + ab.x * (y1 - a.y) / ab.y;
x1 = std::max(0, x1);
}
if (y2 < 0) {
// upper left -> lower right
y2 = 0;
x2 = a.x + ab.x * (y2 - a.y) / ab.y;
x2 = std::min(back_size.x - 1, x2);
} else if (y2 >= back_size.y) {
// lower left -> upper right
y2 = back_size.y - 1;
x2 = a.x + ab.x * (y2 - a.y) / ab.y;
x2 = std::min(back_size.x - 1, x2);
}
Vec4Si32 rgba_a(static_cast<Si32>(color_a.r),static_cast<Si32>(color_a.g),static_cast<Si32>(color_a.b),static_cast<Si32>(color_a.a));
Vec4Si32 rgba_b(static_cast<Si32>(color_b.r),static_cast<Si32>(color_b.g),static_cast<Si32>(color_b.b),static_cast<Si32>(color_b.a));
Vec4Si32 rgba_ab = rgba_b - rgba_a;
Vec4Si32 rgba_1 = rgba_a + rgba_ab * (x1 - a.x) / ab.x;
Vec4Si32 rgba_2 = rgba_a + rgba_ab * (x2 - a.x) / ab.x;
Vec4Si32 rgba_12 = rgba_2 - rgba_1;
if (x2 <= x1) {
if (x2 == x1) {
Rgba color(rgba_1.x, rgba_1.y, rgba_1.z, rgba_1.w);
back.RgbaData()[x1 + y1 * back.StridePixels()] = color;
}
return;
}
Vec4Si32 rgba_16 = rgba_1 * 65536;
Vec4Si32 rgba_12_16 = rgba_12 * 65536;
Vec4Si32 rgba_12_16_step = rgba_12_16 / (x2 - x1);
Si32 y_16 = y1 * 65536;
Si32 y12_16_step = ((y2 - y1) * 65536) / (x2 - x1);
Si32 stride = back.StridePixels();
for (Si32 x = x1; x <= x2; ++x) {
Rgba color(rgba_16.x >> 16,rgba_16.y >> 16,rgba_16.z >> 16,rgba_16.w >> 16);
back.RgbaData()[x + (y_16 >> 16) * stride] = color;
rgba_16 += rgba_12_16_step;
y_16 += y12_16_step;
}
}
} else { // тут почти тоже самое
if (a.y > b.y) {
DrawLine(b, a, color_b, color_a);
} else {
Sprite back = GetEngine()->GetBackbuffer();
Vec2Si32 back_size = back.Size();
if (ab.y == 0) {
if (a.y >= 0 && a.y < back_size.y && a.x >= 0 && a.x < back_size.x) {
back.RgbaData()[a.x + a.y * back.StridePixels()] = color_a;
}
return;
}
Si32 y1 = std::max(0, a.y);
Si32 y2 = std::min(back_size.y - 1, b.y);
Si32 x1 = a.x + ab.x * (y1 - a.y) / ab.y;
Si32 x2 = a.x + ab.x * (y2 - a.y) / ab.y;
if (x1 < 0) {
if (x2 < 0) {
return;
}
// lower left -> upper right
x1 = 0;
y1 = a.y + ab.y * (x1 - a.x) / ab.x;
y1 = std::max(0, y1);
} else if (x1 >= back_size.x) {
if (x2 >= back_size.x) {
Взято отсюда https://github.com/FrostyMorning/arctic/blob/master/engine/easy.cpp
https://pastebin.com/p26FvZdd
0
#include <stdio.h>;
void check(int x, int y) {
if (2*x == y && y < 0 && 0 <= 2*x) {
puts("Impossible!");
}
}
int main() {
check(0x7F80007F, 0xFF0000FE);
}
https://runtimeverification.com/blog/?p=257
When writing code for a specific compiler you can rely on the implementation-specified behavior, but signed overflow is still problematic. GCC promises that conversions between integer types will be reduced modulo the appropriate power of two when the value is not representable in the target type. This means that with GCC the conversion above will initialize var to -0x112234 on any architecture that GCC supports. However, only initialization and other conversions are safe. GCC still considers signed overflow in arithmetic as undefined behavior, and optimizes under the assumption that there will be no overflow. This can lead to apparently impossible results when signed values do overflow. Compiled with -O3, this program prints “Impossible!”.
By adding apparently-redundant casts to 2*x to give (int)(2*(unsigned int)x), the calculation becomes implementation-specified behavior from an out-of-range conversion instead of undefined behavior. While this code may not be portable between compilers, GCC now guarantees the “impossible” code will not be executed even with -O3.
0
import java.util.*;
public class Main
{
public static void main(String[] args)
{
two s = new two(25);
s.get();
}
}
class one
{
private int a;
one(int a)
{
this.a = a*2;
}
void get()
{
System.out.println(a);
}
}
class two extends one
{
void get()
{
get();
}
two(int a)
{
super(a);
}
}
Когда пытаешься вызвать функцию подкласса из класса
0
#!/system/bin/bash
indexOf()
{
echo "$1" "$2" | awk '{print index($1,$2)}'
}
str=$(wget -q -O - http://quote-citation.com/random)
str=${str//\"/} #??????? ???????
str=${str//\'/}
indexOf "$str" "inner"
Вот хуй поймёшь что хотели написать в этом коде
0
int r_k ( char *text, char *point, int d, int q ){
int n = strlen( text);
int m = strlen(point );
int h = (int) pow(d , m - 1 ) % q ;
int i;
int p = 0;
int t = 0;
int j ;
for(i = 0 ;i < m ; i++ ){
p = ( (d*p) + point[i]) % q;
t = ( (d*t) + text[i]) % q;
}
for(i = 0; i <= (n - m) ; i++ ){
if(p == t ){
for(j = 0 ; j < m ; j++)
if( text[i + j] != point[j])
break;
if ( j == m )
return i;
}
t = ( ( (d * (t - text[i] * h) ) + (text[i + m])) % q ) + q ;
}
return 0;
}
Даже " Касперский" сказал что это говно и молча удалил.
−2
for (int i = 0; i < components.Length; i++)
{
if (components[i]) components[i].GetComponent<ComponentScript>().ChangeComponent(CalculateCircuitScript.ComponentDataArray[components[i].GetComponent<ComponentScript>().lineNumber, components[i].GetComponent<ComponentScript>().elementNumber]);
}
Конструктор трёхфазных цепей на Unity3D