- 1
- 2
Страйкер, даешь неделю отдыха гостям!
А то они тут совсем из сил выбились… http://govnokod.ru/3410
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
Страйкер, даешь неделю отдыха гостям!
А то они тут совсем из сил выбились… http://govnokod.ru/3410
+157
void foo()
{
if (!wxFile::Exists(defDir + resourcePath)) return false;
HBITMAP *bmp = new HBITMAP;
wxString path = defDir + resourcePath;
(*bmp) = (HBITMAP)LoadImage(0, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if (bmp != NULL) (*pMap)[resourceName] = bmp; else return false;
return true;
}
bool SXXXXBitmapStorage::releaseItem(wxString resourceName)
{
ScrollBitmapHash::iterator iterator = pMap->find(resourceName);
if (iterator == pMap->end()) return false;
if (iterator->second != NULL) delete (HBITMAP*)iterator->second;
pMap->erase(resourceName);
return true;
}
HDC* SXXXXBitmapStorage::adjustToDC(wxString resourceName)//we must delete this object
{
HBITMAP *bmp = this->getItem(resourceName);
if (bmp == NULL) return NULL;
HDC *pDC = new HDC();
(*pDC) = CreateCompatibleDC(0);
SelectObject(*pDC, *bmp);
return pDC;
}
И вы не поверите, этот код работал! Правда, конечно же, была утечка ресурсов
+162
Allow* AccessSection::check(CONNECTION * connection, char *username, char *password)
{
...
if (current->username != "" && username != "" && current->username != username)
continue;
...
Кусок кода из прокси-сервера Shweby
+164
mysql_query("INSERT INTO `classes` (`name`) VALUES('".$_POST["class_name"]."')");
$Mresult=mysql_query("SELECT MAX(`id`) FROM `classes`");
$row=mysql_fetch_row($Mresult);
$class_num=$row[0];
$date1=$_POST["class_start"];
$date2=$_POST["class_end"];
mysql_query("CREATE TABLE `class_".$class_num."_lessons` (`id` INT, `data` TEXT)");
mysql_query("CREATE TABLE `class_".$class_num."_video` (`id` INT, `data` TEXT)");
mysql_query("CREATE TABLE `class_".$class_num."_ege` (`id` INT, `data` TEXT)");
mysql_query("CREATE TABLE `class_".$class_num."_rasp` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `data` TEXT)");
+162
function plusDay($data){
$dat=explode(".",$data);
if ($dat[0]<28){
$dat++;
} else {
if (($dat[1]!=2)&&($dat[0]<31)){
$dat[0]++;
}
if (($dat[1]==2)&&($dat[0]==28)){
$dat[1]++;
$dat[0]=1;
}
if (($dat[1]==1)&&($dat[1]==3)&&($dat[1]==5)&&($dat[1]==7)&&($dat[1]==8)&&($dat[1]==10)&&($dat[1]==12)&&($dat[0]==31)){
$dat[0]=1;
if ($dat[1]==12){
$dat[2]++;
$dat[1]=1;
}else{
$dat[1]++;
}
}
if (($dat[1]==4)&&($dat[1]==6)&&($dat[1]==9)&&($dat[1]==11)&&($dat[0]==30)){
$dat[0]=1;
$dat[1]++;
}
}
return implode(".",$dat);
}
+192
<शैली श्रेणी>
#समावेश <मानकपन.स>
श्रेणी जानवर
{
खुला:
भव व्योम लिखो()
{
म_लिखो("यह एक जानवर है।\n");
}
};
श्रेणी शेर : खुला जानवर
{
खुला:
व्योम लिखो()
{
म_लिखो("शेर एक जानवर है।\n");
}
};
श्रेणी चीता : खुला जानवर
{
खुला:
व्योम लिखो()
{
म_लिखो("चीता एक जानवर है।\n");
}
};
पूर्णांक मुख्य()
{
जानवर ज, *ज१;
शेर श;
चीता च;
ज.लिखो();
श.लिखो();
च.लिखो();
ज१=&ज;
ज१->लिखो();
ज१=&श;
ज१->लिखो();
ज१=&च;
ज१->लिखो();
वापस 0;
}
Вот вы все говорите про индусский код, а он на самом деле вот такой! Мне кажется, простой и логичный!
(Дистрибутив на http://hindawi.in/en_US/download.php)
−154
import urllib
import time
import pygame
filename = u"c:\\python_crack\\404.txt"
filename2 = u"c:\\python_crack\\found.txt"
music_file = "bizwarn.wav"
happy="deeoo.wav"
freq = 44100 # audio CD quality
bitsize = -32 # unsigned 16 bit
channels = 2 # 1 is mono, 2 is stereo
buffer = 1024 # number of samples
pygame.mixer.init(freq, bitsize, channels, buffer)
# optional volume 0 to 1.0
pygame.mixer.music.set_volume(1)
def play_music(music_file):
"""
stream music with mixer.music module in blocking manner
this will stream the sound from disk while playing
"""
clock = pygame.time.Clock()
try:
pygame.mixer.music.load(music_file)
print "Music file %s loaded!" % music_file
except pygame.error:
print "File %s not found! (%s)" % (music_file, pygame.get_error())
return
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
# check if playback has finished
clock.tick(30)
def urlget(pas):
str_="http://yana.megalinecom.ru/56784/sms/"+pas+"/"
ff=urllib.urlopen(str_)
l=ff.readlines()
ff.close
return l[2]
def save(fn,st):
f=file(fn,'a')
print >> f, st
f.close
for i in range(32500,99999):
time.sleep(0.28)
pasw=str(i)
try:
text = urlget(pasw)
except:
print "Exception!!!!"
i=i-1
save(filename2,pasw+' | ')
play_music(music_file)
time.sleep(60)
nfs='<title>404 Not Found</title>'+'\n'
if text==nfs:
found=0
save(filename, pasw+' | '+text)
else:
found=1
save(filename2,pasw+' | '+text)
play_music(happy)
print pasw+' | '+str(found)
Короче когда-то тупые вэб-мастера присылали спам на сайт знакомств. Такое: Воя я телка, хочешь меня, зайди на сайт такой-то... А хочешь номер телефона отправь СМС и введи код. При вводе случайных кодов, я обнаружил что они тупо пишутся в GET типа ввел 45454 -> www.porno.au/45454/ . Я как истинный ХАКЕР сразу же сел и сделал перебор всех номеров. Получил в файл правильные ключи, но на сайте было написано "Мы на реконструкции" - то-есть лохотрон на лохотроне!
Суть: питон легко писать и быстро, но пробелы достали. Кто сделает оболочку для питона, я буду писать:
def save(fn,st)
{
f=file(fn,'a')
print >> f, st
f.close
}
А прога будет выдавать:
def save(fn,st):
f=file(fn,'a')
print >> f, st
f.close
+132
http://foto.golden.ru/tags/%3cbr%3e%3ciframe%20src=http:%252F%252Fblogs.golden.ru%20width=800%20height=600%3e
Оказывается, говнокодить можно и в URL. Ещё бы javascript в эту строку воткнуть...
+122
int sum = 0;
sum += int.Parse( numericUpDown1.Value.ToString());
sum += int.Parse( numericUpDown2.Value.ToString() );
sum += int.Parse( numericUpDown3.Value.ToString() );
sum += int.Parse( numericUpDown4.Value.ToString() );
sum += int.Parse( numericUpDown5.Value.ToString() );
+157
// ==UserScript==
// @name govnokod.ru.user.js
// @description highlight for new comments
// @author [email protected]
// @include http://govnokod.ru/*
// ==/UserScript==
if(!jQuery.cookie)
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
var there_href = document.location.href.match(/govnokod\.ru\/(\d+)/);
if ( there_href ) // in topic
$(document).ready(function() {
var govnokod_n = there_href[1];
var cookiename = 'gk'+govnokod_n
var lastvisit = new Date(parseInt($.cookie(cookiename)));
var now = new Date();
var comments = $(".hcomment abbr").filter(function(index,elem) {
var date=new Date(elem.title.replace("T"," ").replace(/\+(\d\d):(\d\d)$/," GMT+$1$2"));
return date>lastvisit;
});
for (var i=0;i<comments.length;i++)
{
var elem = comments[i];
var header = elem.parentElement;
var block = elem.parentElement.parentElement;
block.style.background = '#FACE8D';
var anchor = document.createElement("a");
anchor.setAttribute('name','new_'+i);
block.insertBefore(anchor,block.firstChild);
var prevlink = document.createElement("a");
if (i!=0)
prevlink.setAttribute('href','#new_'+(i-1));
prevlink.appendChild(document.createTextNode('⟵'));
header.insertBefore(prevlink,elem.nextSibiling);
header.insertBefore(document.createTextNode(' '),elem.nextSibiling);
var nextlink = document.createElement("a");
if (i!=comments.length-1)
nextlink.setAttribute('href','#new_'+(i+1));
nextlink.appendChild(document.createTextNode('⟶'));
header.insertBefore(nextlink,elem.nextSibiling);
}
var new_comments_count = document.createElement("a");
if (comments.length)
new_comments_count.setAttribute('href','#new_0');
new_comments_count.appendChild(document.createTextNode(''+comments.length+' новых'));
var comments_count = $(".enrty-comments-count");
comments_count.text(comments_count.text().replace(/\)$/,', '));
comments_count.append(new_comments_count);
comments_count.append(')');
$.cookie(cookiename, now.valueOf(), { 'expires': 3 }); //помним, что имеется ограничение на размер куков.
});
Наговнокодил подсвечивалку новых комментариев для говногод.ру. Смесь из обычного DOM и тутошнего jQuery. Сохранить как govnokod.ru.user.js. Тестировал только в опере.