- 1
- 2
- 3
- 4
- 5
- 6
BYTE* ptr = PreventCommand(mode,3);
WORD chksum=this->calc_chksum((BYTE*)(ptr+2));
ptr[4] = (char)(chksum/256 & 0xff);
ptr[5] = (char)(chksum%256 & 0xff);
_interface_array[0]->write(ptr,6, NULL);
delete [] ptr;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+164
BYTE* ptr = PreventCommand(mode,3);
WORD chksum=this->calc_chksum((BYTE*)(ptr+2));
ptr[4] = (char)(chksum/256 & 0xff);
ptr[5] = (char)(chksum%256 & 0xff);
_interface_array[0]->write(ptr,6, NULL);
delete [] ptr;
Формирование пакета
На третью и четвертую строки смотреть особенно больно.
+75
//...
Hashtable somehash = new Hashtable();
//...
public String keyByValue (String value) {
String s;
while (somehash.elements().hasMoreElements()) {
s = (String) somehash.elements().nextElement(); //!!!
if (s.equals(value)) { //!!!
return s;
}
}
return null;
}
+150
$stat_connect = @mysql_connect("stats.amxbans.de","amxbstats","");
*skipped…*
@mysql_close($stat_connect) or die(mysql_error());
−158
ParticleArray.push(new ParticleExplosion());
var par:ParticleExplosion = ParticleArray[ParticleArray.length - 1];
Запихнуть в массив, а потом сразу же выдернуть, чтобы с этим поработать ))
+165
alert(( (/([^(A-z)&&(А-я)])/ || prompt.length<1 ).test(prompt('Введите Ваше имя',''))) ? 'Ошибка' : 'Принято')
Не совсем говнокод, просто весёлый бред. Найдено здесь http://tinyurl.com/22w4b8q
+151
void TPEForm::LoadFromFile(AnsiString _FileName)
{
FileName = _FileName;
Caption = FileName + " - " + DOS_HEADER_STRING;
iPEFileHandle = FileOpen(FileName,fmOpenRead);
FileRead(iPEFileHandle,&dos_header,sizeof(IMAGE_DOS_HEADER));
TreeView->Items->AddChild(NULL,DOS_HEADER_STRING);
dos_header_frame = new TDOSHeader(this);
dos_header_frame->Parent = Panel;
dos_header_frame->e_magic->Text = "0x"+IntToHex(dos_header.e_magic,4);
dos_header_frame->e_cblp->Text = "0x"+IntToHex(dos_header.e_cblp,4);
dos_header_frame->e_cp->Text = "0x"+IntToHex(dos_header.e_cp,4);
dos_header_frame->e_crlc->Text = "0x"+IntToHex(dos_header.e_crlc,4);
dos_header_frame->e_cparhdr->Text = "0x"+IntToHex(dos_header.e_cparhdr,4);
...
dos_header_frame->e_ovno->Text = "0x"+IntToHex(dos_header.e_ovno,4);
dos_header_frame->e_oemid->Text = "0x"+IntToHex(dos_header.e_oemid,4);
dos_header_frame->e_oeminfo->Text = "0x"+IntToHex(dos_header.e_oeminfo,4);
dos_header_frame->e_lfanew->Text = "0x"+IntToHex((int)dos_header.e_lfanew,4);
...
TreeView->Items->AddChild(nt_header_node,FILE_HEADER_STRING);
file_header_frame = new TFileHeader(this);
file_header_frame->Parent = Panel;
file_header_frame->Machine->Text = "0x"+IntToHex((int)nt_header.FileHeader.Machine,4);
file_header_frame->NumberOfSections->Text = "0x"+IntToHex((int)nt_header.FileHeader.NumberOfSections,4);
file_header_frame->TimeDateStamp->Text = "0x"+IntToHex((int)nt_header.FileHeader.TimeDateStamp,8);
file_header_frame->PointerToSymbolTable->Text = "0x"+IntToHex((int)nt_header.FileHeader.PointerToSymbolTable,8);
file_header_frame->NumberOfSymbols->Text = "0x"+IntToHex((int)nt_header.FileHeader.NumberOfSymbols,8);
file_header_frame->SizeOfOptionalHeader->Text = "0x"+IntToHex((int)nt_header.FileHeader.SizeOfOptionalHeader,4);
file_header_frame->Characteristics->Text = "0x"+IntToHex((int)nt_header.FileHeader.Characteristics,4);
TTreeNode *optional_header_node = TreeView->Items->AddChild(nt_header_node,OPTIONAL_HEADER_STRING);
optional_header_frame = new TOptionalHeader(this);
optional_header_frame->Parent = Panel;
TreeView->Items->AddChild(optional_header_node,STANDARD_FIELDS_STRING);
standard_fields_frame = new TStandardFieldsFrame(this);
standard_fields_frame->Parent = Panel;
TTreeNode *additional_fields_node = TreeView->Items->AddChild(optional_header_node,ADDITIONAL_FIELDS_STRING);
additional_fields_frame = new TAdditionalFieldsFrame(this);
additional_fields_frame->Parent = Panel;
standard_fields_frame->Magic->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.Magic,4);
standard_fields_frame->MajorLinkerVersion->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.MajorLinkerVersion,2);
...
additional_fields_frame->ImageBase->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.ImageBase,8);
additional_fields_frame->SectionAlignment->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.SectionAlignment,8);
additional_fields_frame->FileAlignment->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.FileAlignment,8);
...
писал на третьем курсе загрузку заголовка PE-файлов в GUI
−178
try:
os.mkdir(conf_path)
except WindowsError,e:
if "[Error 183]" not in str(e):
QMessageBox.critical(self, "Logon error","Я блять настоящий индус!")
+164
$img_type = ".jpg";
$s = getimagesize($image);
if ($s[2] == "1") {
$img_type = ".gif";
} elseif ($as2] == "3") {
$img_type = ".png";
}
if ($img_type == ".jpg") {
$img = imagecreatefromjpeg($image);
} elseif($img_type == ".gif") {
$img = imagecreatefromgif($image);
} elseif ($img_type == ".png") {
$img = imagecreatefrompng($image);
}
$im = add_watermark($img, $image, $watermark);
if ($img_type == ".jpg") {
imagejpeg($im, $image, 85);
} elseif { ($img_type == ".gif")
imagegif($im , $image);
} elseif { ($img_type == ".png")
imagepng($im , $image);
}
Накладываем водяной знак на изображение
+145
/*Выпадающее меню - рассчитывание координат и выполнение определенных действий при определенных координатах курсора*/
//document.onmousemove = function(e){
// var mCur = mousePageXY(e);
//}
//function mousePageXY(e)
//{
// var x = 0, y = 0;
//
// if (!e) e = window.event;
//
// if (e.pageX || e.pageY)
// {
// x = e.pageX;
// y = e.pageY;
// }
//
// else if (e.clientX || e.clientY)
// {
// x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
// y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
// }
// if ((((screen.width/2-491)>x)||(screen.width/2+409<x))||((screen.width/2-491<x)&&(y<125)&&((screen.width/2-274)>x))||(y>170+height)||(((screen.width/2-274)<x)&&(y<173))) {
// document.getElementById("menu").style.display = 'none'
// }
// return {
// "x":x,
// "y":y
// };
//}
+187
function get_rand_symbols($numeric) {
if($numeric == '1') { return 'п'; }
if($numeric == '2') { return 'р'; }
if($numeric == '3') { return 'о'; }
if($numeric == '4') { return 'к'; }
if($numeric == '5') { return 'е'; }
if($numeric == '6') { return 'а'; }
if($numeric == '7') { return 'д'; }
if($numeric == '8') { return 'е'; }
if($numeric == '9') { return 'й'; }
if($numeric == '10') { return 'в'; }
if($numeric == '11') { return 'м'; }
if($numeric == '12') { return 'л'; }
if($numeric == '13') { return 'с'; }
if($numeric == '14') { return 'т'; }
if($numeric == '15') { return 'у'; }
if($numeric == '16') { return 'н'; }
if($numeric == '17') { return 'ш'; }
if($numeric == '18') { return 'х'; }
if($numeric == '19') { return 'щ'; }
if($numeric == '20') { return 'ъ'; }
if($numeric == '21') { return 'ю'; }
if($numeric == '22') { return 'б'; }
if($numeric == '23') { return 'я'; }
if($numeric == '24') { return 'ц'; }
if($numeric == '25') { return 'ч'; }
if($numeric == '26') { return 'ё'; }
if($numeric == '27') { return 'э'; }
if($numeric == '28') { return 'з'; }
if($numeric == '29') { return 'и'; }
if($numeric == '30') { return 'ы'; }
}
function all_rand() {
return get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30));
}
случайная строка с русскими символами