- 1
- 2
- 3
- 4
- 5
(* We open this module at the top of module generating rules, to make sure they don't do
Io manually *)
module No_io = struct
module Io = struct end
end
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
(* We open this module at the top of module generating rules, to make sure they don't do
Io manually *)
module No_io = struct
module Io = struct end
end
https://github.com/janestreet/jbuilder/blob/0c2228e7bc7f5667a4ca2c982feb76130156ec99/src/import.ml#L524
0
function numeral($s, $t1, $t3, $t5)
{
$s = intval($s) % 100;
$z2 = intval($s / 10);
$z3 = $s % 10;
return ($z3 == 0) || ($z3 > 4) || ($z2 == 1)
? $t5
: (($z3 > 1) && ($z3 < 5) ? $t3 : $t1);
}
function fileSizeInKB($size)
{
if ($size < 1024) {
return intval($size) . ' ' . numeral($size, 'байт', 'байта', 'байтов');
} else {
$size /= 1024;
if ($size < 1024)
return intval($size) . ' КБ';
else
return intval($size / 1024) . ' МБ';
}
}
high top pluralization method
+1
...
private enum CSPTitle {
CONTENT_SECURITY_POLICY, X_CONTENT_SECURITY_POLICY, X_WEBKIT_CSP;
public String getName() {
return WordUtils.capitalizeFully(this.name(), new char[] { '_' }).replace('_', '-');
}
}
...
public Map<String, String> getHeaders(boolean disableXWebkitCspHeader, StringBuilder cspHeaderBodyBuilder){
Map<String, String> cspHeaders = new HashMap<>();
for (CSPTitle cspTitle : CSPTitle.values()) {
if (disableXWebkitCspHeader && CSPTitle.X_WEBKIT_CSP.equals(cspTitle)) {
continue;
}
String cspHeaderBody = cspHeaderBodyBuilder.toString();
if (CSPTitle.X_CONTENT_SECURITY_POLICY.equals(cspTitle)) {
cspHeaderBody = processXCSPHeader(cspHeaderBody);
}
cspHeaders.put(cspTitle.getName(), cspHeaderBody.trim());
}
return cspHeaders;
}
....
0
public ReadFile(string path)
{
byte[] BinFile = File.ReadAllBytes(path);
if (((IEnumerable<byte>) BinFile).Count<byte>() <= 25)
return;
this._Version = BinFile[0].ToString() + "." + BinFile[1].ToString() + "." + BinFile[2].ToString();
}
Я вам тут израильского инжиниринга принёс. Читаем файл, читаем версию.
В этом коде прекрасно всё...
−2
PHP - самое большое говно которое я встречал. Стив Джобс
−6
#include <stdio.h>
//аналог стрингбилдеру который есть в java!!!
#define NUM 1000 //максимальный размер строки
typedef struct {
char str[NUM];
} StringBuilder;
void append(StringBuilder *sb, char *str) //добавление строки
{
sprintf(sb->str, "%s%s", sb->str, str); //гениально и просто хули
}
void setLength(StringBuilder *sb, int s)
{
if(s > NUM || s < 0) return; //жуть
sb->str[s]='\0'; //гениальнетибл!
}
int main()
{
StringBuilder sb;
sprintf(sb.str, "Привет америкосам");
printf("%s\n", sb.str);
append(&sb, ", я вас уделаю!");
printf("%s\n", sb.str);
setLength(&sb, 2);
printf("%s\n", sb.str);
setLength(&sb, 0);
printf("%s\n", sb.str);
return 0;
}
понос или не понос вот в чем вопрос
+2
import os
import argparse
import sys
parser = argparse.ArgumentParser(description='tree')
parser.add_argument('path',type=str,)
parser.add_argument('-fo','--folders_only',action='store_true',)
parser.add_argument('-i','--include',type=str,action='store',)
parser.add_argument('-e','--exclude',type=str,action='store',)
parser.add_argument('-a','--all',action='store_true',)
parser.add_argument('-f','--full_name',action='store_true',)
args = parser.parse_args()
print(sys.argv[1])
if args.include:
itext = args.include
if args.exclude:
etext = args.exclude
def divine_crutch(path, n):
dir = os.listdir(path)
for i in range(len(dir)):
if os.path.isfile(path + '\\' + dir[i]):
if not(args.folders_only):
if not(args.include and itext not in dir[i]):
if not(args.exclude and etext in dir[i]):
if not(not(args.all) and dir[i][0] == '.') and not(args.full_name):
print(n*' ', dir[i])
elif args.full_name and not(not(args.all) and dir[i][0] == '.'):
print(n*' ' ,path + '\\' + dir[i])
if os.path.isdir(path + '\\' + dir[i]):
if not(not(args.all) and dir[i][0] == '.') and not(args.full_name):
print(n*' ', dir[i])
elif args.full_name and not(not(args.all) and dir[i][0] == '.'):
print(n*' ' ,path + '\\' + dir[i])
n += 4
divine_crutch(path + '\\' + dir[i], n)
n -= 4
divine_crutch(sys.argv[1], 4)
Рекурсивный велосипед на костыльной тяге. Сей экземпляр является "аналогом системной утилиты tree под линукс". При подходящей фазе луны и выполнении условий ритуала чёрной магии, способен захавать 16 гигов оперативки и крашнуть систему. Прекрасный способ выстрелить в ногу на питоне. Достойное место в моей кунсткамере.
+1
def with_batched_ids(count, ids)
if ids.is_a? Array
if ids.length > 1
ids.each_slice(count) do |ids|
yield(ids)
end
else
yield(ids)
end
else
yield(ids)
end
end
Заshitное программирование и просто красивая портянка из yield - end - else. Как на ровном месте придумать целый метод.
+1
tms код DSP пример MMACF32
msubf32 MR1,MR1,MR2 ;
|| mmov32 @point14,mr0 ;
mmov32 @point15,mr1 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmov32 mr2,@point01 ; 01
msubf32 mr2,mr2,mr1 ; 01-15
|| mmov32 mr1,@_cos2 ; B
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmpyf32 mr2,mr2,mr1 ;mr2=(01-15)B
|| mmov32 mr1,@point02 ; 02
msubf32 mr0,mr1,mr0 ;mr0=(02-14)
|| mmov32 mr1,@_cos4 ; C
mmov32 mr3,@point00 ; 00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmacf32 mr3,mr2,mr2,mr1,mr0 ;mr3=00+(01-15)B mr2=(02-14)C
|| mmov32 mr0,@point03 ;
mmov32 mr1,@point13 ;
msubf32 mr0,mr0,mr1 ;
|| mmov32 mr1,@_cos6 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mmacf32 mr3,mr2,mr2,mr1,mr0 ;mr3=00+(01-15)B+(02-14)C mr2=(03-13)D
|| mmov32 mr0,@point05 ;
mmov32 mr1,@point11 ;
msubf32 mr0,mr0,mr1 ;
|| mmov32 mr1,@_cos10 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
...............
+2
string shifarhex(string count)
{
string take,take2;
string getch1;
getch1=count;
string sub1 = "0000";//2 to 3 31
unsigned int pos1 = getch1.find(sub1,0);
if(pos1 != string::npos)
{
take2="0";
}
string sub2 = "0001";//2 to 3 31
unsigned int pos2 = getch1.find(sub2,0);
if(pos2 != string::npos)
{
take2="1";
}
string sub3 = "0010";//2 to 3 31
unsigned int pos3 = getch1.find(sub3,0);
if(pos3 != string::npos)
{
take2="2";
}
string sub4 = "0011";//2 to 3 31
unsigned int pos4 = getch1.find(sub4,0);
if(pos4 != string::npos)
{
take2="3";
}
string sub5 = "0100";//2 to 3 31
unsigned int pos5 = getch1.find(sub5,0);
if(pos5 != string::npos)
{
take2="4";
}
string sub6 = "0101";//2 to 3 31
unsigned int pos6 = getch1.find(sub6,0);
if(pos6 != string::npos)
{
take2="5";
}
string sub7 = "0110";//2 to 3 31
unsigned int pos7 = getch1.find(sub7,0);
if(pos7 != string::npos)
{
take2="6";
}
string sub8 = "0111";//2 to 3 31
unsigned int pos8 = getch1.find(sub8,0);
if(pos8 != string::npos)
{
take2="7";
}
string sub9 = "1000";//2 to 3 31
unsigned int pos9 = getch1.find(sub9,0);
if(pos9 != string::npos)
{
take2="8";
}
string sub10 = "1001";//2 to 3 31
unsigned int pos10 = getch1.find(sub10,0);
if(pos10 != string::npos)
{
take2="9";
}
string sub11 = "1010";//2 to 3 31
unsigned int pos11 = getch1.find(sub11,0);
if(pos11 != string::npos)
{
take2="A";
}
string sub12 = "1011";//2 to 3 31
unsigned int pos12 = getch1.find(sub12,0);
if(pos12 != string::npos)
{
take2="B";
}
string sub13 = "1100";//2 to 3 31
unsigned int pos13 = getch1.find(sub13,0);
if(pos13 != string::npos)
{
take2="B";
}
string sub14 = "1101";//2 to 3 31
unsigned int pos14 = getch1.find(sub14,0);
if(pos14 != string::npos)
{
take2="D";
}
string sub15 = "1110";//2 to 3 31
unsigned int pos15 = getch1.find(sub15,0);
...
http://www.sql.ru/forum/1269897/delaem-arhivator
Вореционное зожатие битов