- 1
- 2
- 3
- 4
- 5
$f=file('[путь к файлу]');
shuffle($f);
$f[0] - первая случайная строка
$f[1] - вторая случайная строка
$f[2] - третья случайная строка
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
$f=file('[путь к файлу]');
shuffle($f);
$f[0] - первая случайная строка
$f[1] - вторая случайная строка
$f[2] - третья случайная строка
вот PHP еще. если например несколько строк надо. ну и оптимальнее чем предложено выше.
http://megaobzor.com/forum-top-77608.html
Наверху было классическое
$quote=file('words.txt');
echo $quote[rand(0,count($quote)-1)];
+154
function openSQLConnection($data)
{
$db_host = $data["host"];
$db_user = $data["login"];
$db_pass = $data["pass"];
$db_name = $data["db"];
mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
}
Суровый SQL-коннектор, взято из скриптов платежной системы nextpay[ru]
−79
ga = {} --gay/pure lua style
GA = ga --1337 men style
GlobalAdmin = ga --Java style
GlObAlAdMiN = ga --xxx asked :D
globalAdmin = ga --C style
globaladmin = ga --other plain lua style
Долго не могли решить как назвать глобальную таблицу в lua... лучшего решения не нашли.
+217
mov ebx, [sKey]
mov ecx, 31
l9:
;----------loop------------
fprem
shr ebx,1
jnc if9
.......
if9:
fmul st0,st0
;----------loop------------
loop l9
реабилитируюсь за пост несвежего, но смешного говна немного раньше
+144.9
<a href="javascript:void(0)" onclick="this.parentNode.submit(); return false;">Добавить</a>
в ответ на http://govnokod.ru/1994 и длинный флуд в коментах.
говнокод или нормально?
−8
class C
{
val: number;
constructor()
{
this.val = 2;
}
}
function o(val? : C)
{
print(val?.val);
}
function main()
{
o(new C());
o(null);
o();
}
Новый говнокод подоспел.... а как тебе такое слабый ужасный С/C++ ... ты так умеешь?
Результат работы:
C:\temp>C:\dev\TypeScriptCompiler\__build\tsc\bin\tsc.exe --emit=jit --opt --shared-libs=C:\dev\TypeScriptCompiler\__build\tsc\bin\TypeScriptRuntime.dll C:\temp\1.ts
2
0
0
+3
// https://deadlockempire.github.io/
// Игра, где надо играть за планировщик чтоб вызвать дедлок
// https://deadlockempire.github.io/#2-flags
// First Army
while (true) {
while (flag != false) {
;
}
flag = true;
critical_section();
flag = false;
}
// Second Army
while (true) {
while (flag != false) {
;
}
flag = true;
critical_section();
flag = false;
}
The day finally came. The Deadlock Empire opened its gates and from them surged massive amounts of soldiers, loyal servants of the evil Parallel Wizard. The Wizard has many strengths - his armies are fast, and he can do a lot of stuff that we can't. But now he set out to conquer the world, and we cannot have that.
You are our best Scheduler, commander! We have fewer troops and simpler ones, so we will need your help. Already two armies of the Deadlock Empire are approaching our border keeps. They are poorly equipped and poorly trained, however. You might be able to desync them and break their morale.
0
t = rx + (ry * 100);
std::vector<std::string> tmap;
coin = 0;
rcol = 0;
roomname = "Untitled room ["+UtilityClass::String(rx) + "," + UtilityClass::String(ry)+"]";
switch(t)
{
case rn(50,50):
tmap.push_back("283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,284,444,444,444,444,444,444,444,444,444,285,283,284,444,444,444,444,444,444,444,444,444,444,444,444,285,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,363,364,365,0,0,0,403,283,405,0,0,0,363,364,365,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,403,283,405,0,0,0,443,444,445,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("444,444,444,444,444,444,285,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,324,364,364,364,364,364,364,364,364,364,325,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,403,283,283,283,283,283,283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,443,444,444,444,444,444,444,444,444,444,444,444,285,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("364,364,365,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,403,283,324,364,364,364,364,364,364,364,364,364,364,364,365,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,403,283,283,283,283,283,283,283,283,283,283,283,283,283,405,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,443,444,444,444,444,444,444,444,444,444,444,444,444,444,445,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,405,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,403,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,324,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,325,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
tmap.push_back("283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,405,0,0,0,0,0,0,403,283,283,283,283,283,283");
obj.createentity(game, 232, 24, 10, 0, 250500); // (savepoint)
if(game.intimetrial)
{
obj.createblock(0, 0, 0, 8, 240);
}
rcol=1;
roomname = "Get Ready To Bounce";
break;
Именно поэтому я за «std::embed».
https://github.com/TerryCavanagh/VVVVVV/blob/master/desktop_version/src/Labclass.cpp
+2
<?php
define('_SECUR_GAMES', 1);
$rootpath = '../';
require_once '../includes/start.php';
require_once '../includes/function.php';
require_once '../includes/header.php';
if($level >0 AND $fr_id!=0)
{
$header='alliance';
mysql_query("UPDATE `mesto` SET `place` = '".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($header)))))))."' WHERE `uid`=".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($use_id)))))))."");
}
$fr=check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($_GET['f'])))))));
$q = mysql_query("SELECT * FROM `fractions` WHERE `id`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($fr)))))))."'");
$f = mysql_fetch_array($q);
$ucount = mysql_result(mysql_query("SELECT COUNT(*) FROM `fractions_users` WHERE `uid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($use_id)))))))."' AND `fid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($f['id'])))))))."';"), 0);
$fadm = mysql_result(mysql_query("SELECT COUNT(*) FROM `fractions_users` WHERE `uid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($use_id)))))))."' AND `fid`='".check(htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($f['id'])))))))."' AND `adm`=1;"), 0);
if($game==0 OR $level==0 OR $ban==1){
echo "<title>Доступ закрыт!!!</title>";
@since 2019
−1
def da_pizda(update, context):
global da_counter, pizda_counter
text = update.message.text.split()
text = [word.lower() for word in text]
if 'дa' in text or 'da' in text or 'dа' in text:
text.append('да')
if 'пиздa' in text or 'pizda' in text or 'pizdа' in text or 'Πизда' in text:
text.append('пизда')
if 'да' in text:
bot.send_message(chat_id=update.message.chat_id, text='пизда',
reply_to_message_id=update.message.message_id)
pizda_counter += 1
if 'пизда' in text:
bot.send_message(chat_id=update.message.chat_id, text='да',
reply_to_message_id=update.message.message_id)
da_counter += 1
da_counter += update.message.text.split().count('да')
pizda_counter += update.message.text.split().count('пизда')
Бот, проверяющий наличие слов "да" и "пизда" в чате телеграма, и отвечающий соответственно.