-
+4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
def generate_set(max_size, base_images, samples_per_image=100):
assert len(base_images) == CHARS_NUM
input_vec_len = max_size[0] * max_size[1]
output_vec_len = CHARS_NUM
set_size = samples_per_image * CHARS_NUM
x_set = np.empty(shape=(set_size, input_vec_len))
y_set = np.empty(shape=(set_size, output_vec_len))
sample_num = 0
for c, img in base_images.items():
for _ in range(samples_per_image):
x_set[sample_num] = generate_distorted_sample(img)
y_set[sample_num] = char_to_onehot(c)
sample_num += 1
# LOL
rng_state = np.random.get_state()
np.random.shuffle(x_set)
np.random.set_state(rng_state)
np.random.shuffle(y_set)
return x_set, y_set
ТУРЕЛЬ: 1-1 сорцовый кобенный генератор по мотивам: https://govnokod.ru/26434#comment527875.
https://github.com/gost-gk/turel
Принцимп мухи: берём символы русского алфамита с цифрами/пуньктуацией, генерируем из них слегка искажённые картинки, тренируем элементарную модельку —
optimizer = keras.optimizers.Adagrad(learning_rate=0.02)
model = Sequential()
model.add(Dense(units=CHARS_NUM * 2, activation='relu', input_dim=input_vec_len))
model.add(Dense(units=CHARS_NUM, activation='softmax'))
model.compile(loss='categorical_crossentropy',
optimizer=optimizer,
metrics=['accuracy'])
— и пропускаем через неё входную сорцовую психозу. Настоящий «OCR»!
Благодаря тому, что на английских символах модель не обучалась, при распознавании сорцов получается кобенный эффект.
Моделька обучается очень быстро, десятка эпох (примерно по секунде на эпоху на моём корыте) достаточно для 97-98% точности распознавания искажённых символов.
gost,
21 Февраля 2020
-
0
- 1
- 2
- 3
- 4
<?php $o_ids = array();
foreach ($orders_num as $thiso){array_push($o_ids, $thiso->id);}
echo implode(", ", $o_ids);
?>
Найдено в дебрях легаси
fiammathegreat,
19 Февраля 2020
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
// sorry, I don't want to use any JS templater
// so I'll concatenate html as strings, which is the worst practice
// but my IntelliJ IDEA highlights html in strings well :)
// and I write this code just4fun
//
// but to respect production I'll leave here something that will never be fixed
// TODO: rewrite in Angular.js
//
// done!
// ...
// u still read this spaghetti?
let evaluate = (s) => {
completion = [];
hist = [];
let tokens = s.split(' ').filter((s) => s !== '');
if (!tokens[0]) return;
histfile.push(s);
if (tokens[0] === 'clear') clear();
else if (tokens[0] === 'aplay') aplay();
else if (tokens[0] === 'man') try {
template(tokens.slice(0, 2).join('_'))();
} catch {
stdout('No manual entry for <span class="red">' + tokens[1] + '</span>')
}
Сайт-визитка на plain js для подкаста в виде эмулятора терминала с пасхалками
https://deveeps.prost.host/
vistefan,
19 Февраля 2020
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
$('#search-map').on('click', '.v-card-prev', function () {
var v_next = $(this)
.parent()
.find('.v-card-img-block .v-card-img-hidden.active')
.prev();
if ($(v_next).length == 0) {
$(this)
.parent()
.find('.v-card-img-hidden.active')
.removeClass('active');
$(this)
.parent()
.find('.v-card-img-hidden:last')
.addClass('active');
} else {
$(this)
.parent()
.find('.v-card-img-hidden.active')
.removeClass('active');
$(this)
.parent()
.find(v_next)
.addClass('active');
}
$(this)
.parent()
.find('.v-card-img-hidden.active')
.click();
});
$('#search-map').on('click', '.offers-favorite', function () {
var favorID = $(this)
.closest('.js__product')
.attr('data-item');
if ($(this).hasClass('active')) var doAction = 'delete';
else var doAction = 'add';
updateFavorite(favorID, doAction);
return false;
});
phpBidlokoder2,
18 Февраля 2020
-
0
#1: https://govnokod.ru/18142 https://govnokod.xyz/_18142
#2: https://govnokod.ru/18378 https://govnokod.xyz/_18378
#3: https://govnokod.ru/19667 https://govnokod.xyz/_19667
#4: https://govnokod.ru/21160 https://govnokod.xyz/_21160
#5: https://govnokod.ru/21772 https://govnokod.xyz/_21772
#6: (оригинал удалён) https://govnokod.xyz/_24063
#7: https://govnokod.ru/24538 https://govnokod.xyz/_24538
#8: (оригинал удалён) https://govnokod.xyz/_24815
#9: https://govnokod.ru/24867 https://govnokod.xyz/_24867
#10: https://govnokod.ru/25328 https://govnokod.xyz/_25328
#11: (оригинал удалён) https://govnokod.xyz/_25436
#12: (оригинал удалён) https://govnokod.xyz/_25471
#13: (оригинал удалён) https://govnokod.xyz/_25590
#14: https://govnokod.ru/25684 https://govnokod.xyz/_25684
#15: https://govnokod.ru/25694 https://govnokod.xyz/_25694
#16: https://govnokod.ru/25725 https://govnokod.xyz/_25725
#17: https://govnokod.ru/25731 https://govnokod.xyz/_25731
#18: https://govnokod.ru/25762 https://govnokod.xyz/_25762
#19: https://govnokod.ru/25767 https://govnokod.xyz/_25767
#20: https://govnokod.ru/25776 https://govnokod.xyz/_25776
#21: https://govnokod.ru/25798 https://govnokod.xyz/_25798
#22: https://govnokod.ru/25811 https://govnokod.xyz/_25811
#23: https://govnokod.ru/25863 https://govnokod.xyz/_25863
#24: https://govnokod.ru/25941 https://govnokod.xyz/_25941
#25: https://govnokod.ru/26026 https://govnokod.xyz/_26026
#26: https://govnokod.ru/26050 https://govnokod.xyz/_26050
#27: https://govnokod.ru/26340 https://govnokod.xyz/_26340
#28: https://govnokod.ru/26372 https://govnokod.xyz/_26372
#29: https://govnokod.ru/26385 https://govnokod.xyz/_26385
#30: https://govnokod.ru/26413 https://govnokod.xyz/_26413
#31: https://govnokod.ru/26423 https://govnokod.xyz/_26423
gost,
17 Февраля 2020
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
#include <iostream>
#include <map>
std::map<std::string, int> get_map()
{
return {
{ "hello", 1 },
{ "world", 2 },
{ "it's", 3 },
{ "me", 4 },
};
}
int main()
{
for (auto&& [ k, v ] : get_map())
std::cout << "k=" << k << " v=" << v << '\n';
return 0;
}
govnokod3r,
15 Февраля 2020
-
+5
- 1
- 2
- 3
- 4
БОЖЕСТВЕННЫЙ СУДЪ
МАТУШКА ЛИЧНОЕ ИМЯ РОДА В ЧЕСТИ ИНГА
ЗАПРЕЩЕНО НАРУШАТЬ КОН СВОБОДНОЙ ВОЛИ
УТВЕРЖДЕНО
Пост для обсуждания, разработки и каталогизации живых доброй души коберодных вореций.
Срать тут:
gost,
15 Февраля 2020
-
0
- 1
https://mangalib.me/fisheye-placebo/v1/c1?page=3
именно поэтому я за «SSH-соединение»
Fike,
13 Февраля 2020
-
+5
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
begin
G4.Caption:='X';
if G5.Caption='' then
begin
G5.Caption:='X';
if G6.Caption='' then
begin
G6.Caption:='X';
if G7.Caption='' then
begin
G7.Caption:='X';
if G8.Caption='' then G8.Caption:='X' else
if sg8=1 then
G8.Font.Style:=[fsBold,fsStrikeOut];
end else
if sg7=1 then
G7.Font.Style:=[fsBold,fsStrikeOut];
end else
if sg6=1 then
G6.Font.Style:=[fsBold,fsStrikeOut];
end else
if sg5=1 then
G5.Font.Style:=[fsBold,fsStrikeOut];
end else
if sg4=1 then
G4.Font.Style:=[fsBold,fsStrikeOut];
end else
if sg3=1 then
G3.Font.Style:=[fsBold,fsStrikeOut];
end else
if sg2=1 then
G2.Font.Style:=[fsBold,fsStrikeOut];
if H2.Caption='' then H2.Caption:='X' else
if sh2=1 then H2.Font.Style:=[fsBold,fsStrikeOut];
if F2.Caption='' then
begin
F2.Caption:='X';
if E3.Caption='' then
begin
E3.Caption:='X';
if D4.Caption='' then
begin
D4.Caption:='X';
if C5.Caption='' then
begin
C5.Caption:='X';
if B6.Caption='' then
begin
B6.Caption:='X';
if A7.Caption='' then A7.Caption:='X' else
if sa7=1 then
A7.Font.Style:=[fsBold,fsStrikeOut];
end else
if sb6=1 then
B6.Font.Style:=[fsBold,fsStrikeOut];
end else
if sc5=1 then
C5.Font.Style:=[fsBold,fsStrikeOut];
end else
if sd4=1 then
D4.Font.Style:=[fsBold,fsStrikeOut];
end else
if se3=1 then
E3.Font.Style:=[fsBold,fsStrikeOut];
end else
if sf2=1 then
F2.Font.Style:=[fsBold,fsStrikeOut];
end;
6: begin //Король
{E1} if ((se1=1) and not ((E1.Caption<>'Ферзь') or (E1.Caption<>'Ладья') or (E1.Caption<>'Король')) or
{D1} ((sd1=1) and not ((E1.Caption='') and ((D1.Caption='Ферзь') or (D1.Caption='Ладья')))) or
{C1} ((sc1=1) and not (((E1.Caption='') and (D1.Caption='')) and ((C1.Caption='Ферзь') or (C1.Caption='Ладья')))) or
{B1} ((sb1=1) and not (((E1.Caption='') and (D1.Caption='') and (C1.Caption='')) and ((B1.Caption='Ферзь') or (B1.Caption='Ладья')))) or
{A1} ((sa1=1) and not (((E1.Caption='') and (D1.Caption='') and (C1.Caption='') and (B1.Caption='')) and ((A1.Caption='Ферзь') or (A1.Caption='Ладья')))) or
{E2} ((se2=1) and not ((E2.Caption='Слон') or (E2.Caption='Ферзь') or (E2.Caption='Пешка') or (E2.Caption='Король'))) or
//ПРОДОВЖИТИ
{D3} ((sd3=1) and not ((E2.Caption='') and ((D3.Caption='Ферзь') or (D3.Caption='Слон')))) or
{C4} ((sc4=1) and not (((E2.Caption='') and (D3.Caption='')) and ((C4.Caption='Ферзь') or (C4.Caption='Слон')))) or
{B5} ((sb5=1) and not (((E2.Caption='') and (D3.Caption='') and (C4.Caption='')) and ((B5.Caption='Ферзь') or (B5.Caption='Слон')))) or
{A6} ((sa6=1) and not (((E2.Caption='') and (D3.Caption='') and (C4.Caption='') and (B5.Caption='')) and ((A6.Caption='Ферзь') or (A6.Caption='Ладья')))) or
{F2} ((sf2=1) and not (E2.Caption='Ладья') or (E2.Caption='Ферзь')) or
{F3} ((sf3=1) and not ((F2.Caption='') and ((F3.Caption='Ферзь') or (F3.Caption='Ладья')))) or
{F4} ((sf4=1) and not (((F2.Caption='') and (F3.Caption='')) and ((F4.Caption='Ферзь') or (F4.Caption='Ладья')))) or
{F5} ((sf5=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='')) and ((F5.Caption='Ферзь') or (F5.Caption='Ладья')))) or
{F6} ((sf6=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='') and (F5.Caption='')) and ((F6.Caption='Ферзь') or (F6.Caption='Ладья')))) or
{F7} ((sf7=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='') and (F5.Caption='') and (F6.Caption='')) and ((F7.Caption='Ферзь') or (F7.Caption='Ладья')))) or
{F8} ((sf8=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='') and (F5.Caption='') and (F6.Caption='') and (F7.Caption='')) and ((F8.Caption='Ферзь') or (F8.Caption='Ладья')))) or
{G2} ((sg2=1) and not (G2.Caption='Ферзь') or (G2.Caption='Слон')) or
{H3} ((sh3=1) and not ((G2.Caption='') and ((H3.Caption='Ферзь') or (H3.Caption='Слон')))) or
{H1} ((sh1=1) and not (H1.Caption'Ферзь') or (H1.Caption='Слон')) or
{Кони} ((sh2=1) and not (H2.Caption='Конь')) or ((sg3=1) and not (G3.Caption='Конь')) or ((se3=1) and not (E3.Caption='Конь')) or ((sd2=1) and not(D2.Caption='Конь'))
) then if (F1.Caption='') then F1.Caption:='X' else
if sf1=1 then F1.Font.Style:=[fsBold,fsStrikeOut];
end;
Как-то на первом или втором курсе недоунивера возникло желание сделать шахматы в ООП на Паскале. Решил закодить 64 кнопки (8*8 поле). Сделал переменные для идентификации хода черных/белых, для 2 режимов, в первом из которых кликаешь на свою фигуру (надпись на кнопке) и тебе показывают доступные ходы ею (Х куда можно поставить фигуру, подчеркнутое название вражеской фигуры при возможность её забрать). Ты кликаешь, поле очищается от подсказок, фигура перемещается, проверка на шах/мат (ад), ход передается другому цвету фигур (Жирное начертание для определения) и режим взаимодействия с игровым полем опять переходит в выбор фигуры. Теоретически закодировав каждую кнопку на все возможные события шахматы были бы закончены полностью. Вот только спустя окончания кодировки первой кнопки я заYAYлся и забросил ибо говнокод вышел в 1000 строк на одну YAYдь кнопку. Разумеется, показать могу лишь часть
Zick,
12 Февраля 2020
-
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
package clojure.lang;
import java.io.Serializable;
import java.util.*;
public abstract class APersistentVector extends AFn implements IPersistentVector, Iterable,
List,
RandomAccess, Comparable,
Serializable, IHashEq {
int _hash;
int _hasheq;
public String toString(){
return RT.printString(this);
}
public ISeq seq(){
if(count() > 0)
return new Seq(this, 0);
return null;
}
public ISeq rseq(){
if(count() > 0)
return new RSeq(this, count() - 1);
return null;
}
static boolean doEquals(IPersistentVector v, Object obj){
if(obj instanceof IPersistentVector)
{
IPersistentVector ov = (IPersistentVector) obj;
if(ov.count() != v.count())
return false;
for(int i = 0;i< v.count();i++)
{
if(!Util.equals(v.nth(i), ov.nth(i)))
return false;
}
return true;
}
else if(obj instanceof List)
{
Collection ma = (Collection) obj;
if(ma.size() != v.count() || ma.hashCode() != v.hashCode())
return false;
for(Iterator i1 = ((List) v).iterator(), i2 = ma.iterator();
i1.hasNext();)
{
if(!Util.equals(i1.next(), i2.next()))
return false;
}
return true;
}
else
{
if(!(obj instanceof Sequential))
return false;
ISeq ms = RT.seq(obj);
for(int i = 0; i < v.count(); i++, ms = ms.next())
{
if(ms == null || !Util.equals(v.nth(i), ms.first()))
return false;
}
if(ms != null)
return false;
}
return true;
}
Я решил попробовать Clojure: скачал Intellij Idea Comunity Edition поставил Cursive. Кодил значится, кодил, решил посмотре реализацию некоторых функци, начал шерстить по исходникам и дошел до джавовских исходников реализации кложура. Идея мне любезно предложила вместо декомпилированого кода скачать исходники и читать их. Я согласился и скачал, после чего увидел это. Исходное форматирование сохранено.
Это пиздец, товарищи. Кложур как язык - очень хорош, вот прям очень. Но мне в голове не укладывается что вот эта патлатая курва https://github.com/richhickey создатель такого крутого языка, не умеет в форматирование кода. Весь репозиторий - тупо рандом. Как блять, можно делать реализацию языка и даже блять не сделать код стайл. Вы можете подумать, что это и есть код стайл. Но хер там плавал, местами есть привычное джавовское форматирование, местами куча закоментированного кода. Короче полный бардак. Вот, наслаждайтесь https://github.com/clojure/clojure
На самом деле я не сильно то и разочарован. Да и вообще, я пытался смотреть видео с его докладами - меня просто тошнит от него. Тошнит точно так же, как от препода из универа, который вроде бы и шарит, вроде бы и что-то рассказывает, но без малейшего энтузиазма - просто поток текста, монотонный и неинтересный. У человека просто нету таланта/желания именно донести и поджечь интерес.
За создание кложура я его уважаю. Мне просто непонятно, как человек который создал такой хороши язык, не имеет понятия код стайл. Ваши мисли?
Lorip1971,
11 Февраля 2020