Яuбy / Говнокод #29087 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
# Setup the admin service from Microsoft
  def setup_microsoft_admin_service
    # define the empty microsoft picture url
    @no_profile_picture = 'https://secure.aadcdn.microsoftonline-p.com/ests/2.1.5670.18/content/images/work_account.png'
    # Application id and secret from microsoft
    client_id = ENV['AZURE_CLIENT_ID']
    # client_secret = 'z8uGboGliWfBqa8/s8K4KbDH96l1F0+PuFwX+AOGJTQ='
    client_secret = ENV['AZURE_CLIENT_SECRET']
    # Should also be listed in microsoft app
    tenant        = Current.organization['microsoft_azure_domain_hint']
    # Create credentials using Active Directory Azure Library
    client_cred   = ADAL::ClientCredential.new(client_id, client_secret)
    context       = ADAL::AuthenticationContext.new(ADAL::Authority::WORLD_WIDE_AUTHORITY, tenant)
    # Return the acquired tokens from the graph site
    context.acquire_token_for_client('https://graph.microsoft.com', client_cred)
  end

Perfección

Shannarra_ Shannarra_, (Updated )

Комментарии (3, +3)

Куча говна / Говнокод #29086 Ссылка на оригинал

0

  1. 1
Пиздец-оффтоп #107

#77: https://govnokod.ru/28722 https://govnokod.xyz/_28722
#78: https://govnokod.ru/28730 https://govnokod.xyz/_28730
#79: https://govnokod.ru/28736 https://govnokod.xyz/_28736
#80: https://govnokod.ru/28740 https://govnokod.xyz/_28740
#81: https://govnokod.ru/28750 https://govnokod.xyz/_28750
#82: https://govnokod.ru/28779 https://govnokod.xyz/_28779
#83: https://govnokod.ru/28788 https://govnokod.xyz/_28788
#84: https://govnokod.ru/28795 https://govnokod.xyz/_28795
#85: https://govnokod.ru/28808 https://govnokod.xyz/_28808
#86: (vanished) https://govnokod.xyz/_28814
#87: https://govnokod.ru/28817 https://govnokod.xyz/_28817
#88: https://govnokod.ru/28836 https://govnokod.xyz/_28836
#89: https://govnokod.ru/28843 https://govnokod.xyz/_28843
#90: https://govnokod.ru/28874 https://govnokod.xyz/_28874
#91: https://govnokod.ru/28880 https://govnokod.xyz/_28880
#92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
#93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
#94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
#95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
#96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
#97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
#98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
#99: https://govnokod.ru/28936 https://govnokod.xyz/_28936
#100: https://govnokod.ru/28940 https://govnokod.xyz/_28940
#101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
#102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
#103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
#104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
#105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
#106: https://govnokod.ru/29069 https://govnokod.xyz/_29069

nepeKamHblu_nemyx nepeKamHblu_nemyx, (Updated )

Комментарии (441, +441)

Няшная / Говнокод #29085 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv) {
	size_t buflen;
	size_t i;
	char *obuffer;
	if (argc != 2) {
		fprintf(stderr, "Usage: %s 'some ASCII string'\n", argv[0]);
		fprintf(stderr, "\tconvert the string into overlong UTF-8.\n");
		return 1;
	}
	buflen = strlen(argv[1])*2+1;
	obuffer = malloc(buflen);
	if (obuffer == NULL) {
		fprintf(stderr, "Error: cannot allocate %zd bytes of memory.", buflen);
		return 2;
	}
	for (i=0; argv[1][i]; i++) {
		obuffer[2*i]   = 0xC0|(argv[1][i]>>6);
		obuffer[2*i+1] = 0x80|(argv[1][i]&0x3F);
	}
	obuffer[2*i] = '\0';
	puts(obuffer);
	free(obuffer);
	return 0;
}

В UTF-8 запрещено использовать кодовые последовательности не минимальной длины, например юникоды с номером до 127 требуется кодировать именно в один байт, а не в 2,3 и так далее. А если так всё-таки сделать, полученная фигня называется оверлонгом (overlong). Вот этот код их как раз и создаёт. Но только из ASCII символов и расширяя их только до двух байт. Написание более универсального варианта, если вдруг кому-то надо оставляем как упражнение для читателя.

Что интересно, некоторые текстовые редакторы, если в них открыть файл, сделанный этой программой, увидят обычный текст.

Threadwalker Threadwalker, (Updated )

Комментарии (5, +5)

"PHP" / Говнокод #29084 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
<!-- < ?php
$isAdmin = User::checkAdmin();
if($isAdmin) {
?>
<section class="promoCertificate">
<div class="promoCertificate__wrapper">
<img class="promoCertificate__logo" src="/images/header/promoCertificate-logo-big.png">
<div class="promoCertificate__title">
<p class="promoCertificate__title_big">Это знак</p>
<p class="promoCertificate__title_small">ЗН АК КАЧЕСТВА</p>
</div>
<img class="promoCertificate__nagiev" src="/images/header/promoCertificate-nagiev.png">
<div class="promoCertificate__description">Ва м доступен <span class="promoCertificate__description_whi te">личный сертификат</span> на покупку массажного кресла номиналом <span class="promoCertificate__description_whi te promoCertificate__description_big ">30 000 ₽</span></div>
<a href="/personal-certificate" class="promoCertificate__button-details">Подробнее</a>
<button type="button" class="promoCertificate__button-close promoCertificate__button-close_mobile __js-closeCertificatePromo">не интересно</button>
</div>
<button type="button" class="promoCertificate__button-close __js-closeCertificatePromo"></button>
</section>
< ?php }; ?> -->
<!-- модалка с количеством подарков и ссылкой на страницу подарков -->
<!-- удалять prize__hide -->

На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.

McLotos McLotos, (Updated )

Комментарии (1, +1)

"PHP" / Говнокод #29083 Ссылка на оригинал

0

  1. 1
На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.

<!-- < ?php
$isAdmin = User::checkAdmin();
if($isAdmin) {
?>
<section class="promoCertificate">
<div class="promoCertificate__wrapper">
<img class="promoCertificate__logo" src="/images/header/promoCertificate-logo-big.png">
<div class="promoCertificate__title">
<p class="promoCertificate__title_big">Это знак</p>
<p class="promoCertificate__title_small">ЗН АК КАЧЕСТВА</p>
</div>
<img class="promoCertificate__nagiev" src="/images/header/promoCertificate-nagiev.png">
<div class="promoCertificate__description">Ва м доступен <span class="promoCertificate__description_whi te">личный сертификат</span> на покупку массажного кресла номиналом <span class="promoCertificate__description_whi te promoCertificate__description_big ">30 000 ₽</span></div>
<a href="/personal-certificate" class="promoCertificate__button-details">Подробнее</a>
<button type="button" class="promoCertificate__button-close promoCertificate__button-close_mobile __js-closeCertificatePromo">не интересно</button>
</div>
<button type="button" class="promoCertificate__button-close __js-closeCertificatePromo"></button>
</section>
< ?php }; ?> -->
<!-- модалка с количеством подарков и ссылкой на страницу подарков -->
<!-- удалять prize__hide -->

McLotos McLotos, (Updated )

Комментарии (1, +1)

Няшная / Говнокод #29082 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
// https://github.com/AlexCeleste/C99-Lambda
// # C99-Lambda: nested functions, lambdas, and closures, in ISO C99

// https://github.com/AlexCeleste/C99-Lambda/blob/57583080392d5f3f626034bbb3292eb0070ba304/c_lambda.h#L110
// Internal lambda builder functions

#define FN_8CL_ARG_TYPE(T) , T

#define FN_8FEXP(call, p, f, R) { FN_8GETTYPE_8fn f = fn f; call(M_ID p M_IF(M_2ORMORE R, (_fun, M_REST_ R), (_fun))); }
#define FN_8CLEXP(call, p, c, R) { void * _fun = cl c; call(M_ID p M_IF(M_2ORMORE R, (_fun, M_REST_ R), (_fun))); }

#define FN_8EMIT_NS(N, H, B, Q) FN_8EMIT_NS_((FN_8GET_NL(N, B)), H, (M_ZIP_W2(FN_8EMIT_ELEM, B, M_ILIST)), Q)
#define FN_8EMIT_NS_(NL, H, BL, Q) (8ZIPNE,(NL, BL, Q), FN_8EMIT_BODY(NL, H, BL))

#define FN_8GET_NL(N, B) M_ZIP_W2(FN_8GET_NL_1, M_ENLIST(_8anon_##N##_, M_NARGS B), M_ILIST)
#define FN_8GET_NL_1(A, B) , M_CONC_(A, B)
#define FN_8EMIT_BODY(NL, H, BL) M_ID H M_ZIP_WITH(FN_8EMIT_BLOCK, BL, NL)

#define FN_8EMIT_ELEM(E, _) ,M_CONC_(FN_8EMIT_, E)
#define FN_8EMIT_8blk(...) (1, 0, __VA_ARGS__)
#define FN_8EMIT_8fn(...) (0, 0, __VA_ARGS__)
#define FN_8EMIT_8cl(...) (0, 1, __VA_ARGS__)
#define FN_8EMIT_BLOCK(P, N) M_IF(M_FIRST P, (M_REST2 P), (FN_8EMIT_NAME((M_REST P, r, a, o), N)))
#define FN_8EMIT_NAME(P, N) M_IF(M_FIRST P, (FN_8EMIT_CL(N, M_ID P)), (N))
#define FN_8EMIT_CL(...) FN_8EMIT_CL_(__VA_ARGS__)
#define FN_8EMIT_CL_(n, _, r, a, o, ...) (void*)&(struct n##_env_t){ \
  n,sizeof(struct n##_env_t) M_FOR_EACH(FN_8CL_SND, M_ID o) }
#define FN_8CL_SND(P) , M_REST_ P

#define FN_8EMIT_ENV(E, Q) (8DO_Q, (Q), FN_8EMIT_ENV_(E))
#define FN_8EMIT_ENV_(n, rt, a, o) struct n##_env_t { \
  FN_8CTYPE(rt, n, a, _fun); size_t _size; M_FOR_EACH(FN_8FLDS, M_ID o) };
#define FN_8FLDS(F) M_FIRST_ F M_REST_ F;
#define FN_8CL_DEC(rt, n, a) static rt n(void * _envV, M_ID a) { struct n##_env_t * _env = _envV; 

#define FN_8FTYPE(rt, C, a, pn) rt(* C pn)a
#define FN_8CTYPE(rt, n, a, pn) rt(* pn)(void *, M_ID a)
#define FN_8FN_TYPE(F) M_CONC(FN_8GETTYPE_, M_FIRST(M_REST((F))))
#define FN_8GETTYPE_8fn(rt, a, ...) rt(* _fun)a
#define FN_8CLSZ(T, N) T M_CONC(_, N);

#define FN_8ZIPNE(NL, BL, Q) (8FLTNE, ((M_ZIP_W2(FN_8ZIPNE_, NL, BL)), Q))
#define FN_8ZIPNE_(N, B) ,(M_FIRST_ B, N, M_REST_ B)

#define FN_8FLTNE(EL, Q) (8POPEM, ((0 M_FOR_EACH(FN_8FLTNE_, M_ID EL)), Q))
#define FN_8FLTNE_(E) M_IF(M_FIRST_ E, (), (,(M_REST_ E)))

#define FN_8POPEM(FL, Q) M_IF(M_2ORMORE(M_ID FL), ((8F2NS, ((M_REST_ FL), Q))), ((8DO_Q, (Q))))

#define FN_8F2NS(FL, Q) (8DO_Q, ((M_FOR_E2(FN_8F2NS_1, M_ID FL), M_ID Q)))
#define FN_8F2NS_1(F) ,FN_8F2NS_2 F
#define FN_8F2NS_2(n, isC, rt, a, ...) M_IF(isC, \
  ((8EMIT_NS_NX, (n, (FN_8CL_DEC(rt, n, a)), M_REST(__VA_ARGS__))), (8EMIT_ENV,(n, rt, a, M_FIRST(__VA_ARGS__)))), \
  ((8EMIT_NS_NX, (n, (static rt n a), __VA_ARGS__))))

#define FN_8DO_Q(Q) (M_ID(M_FIRST_ M_FIRST_ Q),(M_ID M_REST_ M_FIRST_ Q, (M_REST_ Q)))

#define FN_8EMIT_NS_NX(...) (8EMIT_NS, (__VA_ARGS__))

Ммм, дерьмецо

j123123 j123123, (Updated )

Комментарии (82, +82)

Яuбy / Говнокод #29081 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
if (analysis.document? && analysis.update(name: params[:analysis][:name], description: params[:analysis][:description], anonymous: params[:analysis][:anonymous], dependency: analysis.dependency)) ||
       (analysis.cloud_file_link.present? && analysis.update(name: params[:analysis][:name], description: params[:analysis][:description], anonymous: params[:analysis][:anonymous], dependency: analysis.dependency)) ||
       (analysis.videolink.present? && analysis.update(name: params[:analysis][:name], description: params[:analysis][:description], videolink: params[:analysis][:videolink], anonymous: params[:analysis][:anonymous], dependency: analysis.dependency)) ||
       analysis.update(name: params[:analysis][:name], description: params[:analysis][:description], hyperlink: params[:analysis][:hyperlink], anonymous: params[:analysis][:anonymous], dependency: analysis.dependency)

pls kill me

Shannarra_ Shannarra_, (Updated )

Комментарии (9, +9)

Куча говна / Говнокод #29080 Ссылка на оригинал

0

  1. 1
Политота #35

#5: https://govnokod.ru/24868 https://govnokod.xyz/_24868
#6: (vanished) https://govnokod.xyz/_26648
#7: https://govnokod.ru/26673 https://govnokod.xyz/_26673
#8: https://govnokod.ru/27052 https://govnokod.xyz/_27052
#9: (vanished) https://govnokod.xyz/_27852
#10: https://govnokod.ru/28060 https://govnokod.xyz/_28060
#11: https://govnokod.ru/28091 https://govnokod.xyz/_28091
#12: https://govnokod.ru/28103 https://govnokod.xyz/_28103
#13: https://govnokod.ru/28144 https://govnokod.xyz/_28144
#14: https://govnokod.ru/28270 https://govnokod.xyz/_28270
#15: https://govnokod.ru/28341 https://govnokod.xyz/_28341
#16: https://govnokod.ru/28379 https://govnokod.xyz/_28379
#17: https://govnokod.ru/28394 https://govnokod.xyz/_28394
#18: https://govnokod.ru/28440 https://govnokod.xyz/_28440
#19: https://govnokod.ru/28572 https://govnokod.xyz/_28572
#20: https://govnokod.ru/28656 https://govnokod.xyz/_28656
#21: (vanished) https://govnokod.xyz/_28666
#22: https://govnokod.ru/28676 https://govnokod.xyz/_28676
#23: https://govnokod.ru/28684 https://govnokod.xyz/_28684
#24: https://govnokod.ru/28691 https://govnokod.xyz/_28691
#25: https://govnokod.ru/28698 https://govnokod.xyz/_28698
#26: https://govnokod.ru/28704 https://govnokod.xyz/_28704
#27: https://govnokod.ru/28711 https://govnokod.xyz/_28711
#28: https://govnokod.ru/28721 https://govnokod.xyz/_28721
#29: https://govnokod.ru/28728 https://govnokod.xyz/_28728
#30: (vanished) https://govnokod.xyz/_28747
#31: https://govnokod.ru/28757 https://govnokod.xyz/_28757
#32: https://govnokod.ru/28770 https://govnokod.xyz/_28770
#33: https://govnokod.ru/28835 https://govnokod.xyz/_28835
#34: https://govnokod.ru/28924 https://govnokod.xyz/_28924

nepeKamHblu_nemyx nepeKamHblu_nemyx, (Updated )

Комментарии (463, +463)

Куча говна / Говнокод #29079 Ссылка на оригинал

0

  1. 1
IT Оффтоп #210

#180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
#181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
#182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
#183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
#184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
#185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
#186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
#187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
#188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
#189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
#190: https://govnokod.ru/28875 https://govnokod.xyz/_28875
#191: https://govnokod.ru/28878 https://govnokod.xyz/_28878
#192: https://govnokod.ru/28886 https://govnokod.xyz/_28886
#193: https://govnokod.ru/28911 https://govnokod.xyz/_28911
#194: https://govnokod.ru/28914 https://govnokod.xyz/_28914
#195: https://govnokod.ru/28917 https://govnokod.xyz/_28917
#196: https://govnokod.ru/28925 https://govnokod.xyz/_28925
#197: https://govnokod.ru/28935 https://govnokod.xyz/_28935
#198: https://govnokod.ru/28938 https://govnokod.xyz/_28938
#199: https://govnokod.ru/28942 https://govnokod.xyz/_28942
#200: https://govnokod.ru/28945 https://govnokod.xyz/_28945
#201: https://govnokod.ru/28948 https://govnokod.xyz/_28948
#202: https://govnokod.ru/28951 https://govnokod.xyz/_28951
#203: https://govnokod.ru/28954 https://govnokod.xyz/_28954
#204: https://govnokod.ru/28971 https://govnokod.xyz/_28971
#205: https://govnokod.ru/28986 https://govnokod.xyz/_28986
#206: https://govnokod.ru/28991 https://govnokod.xyz/_28991
#207: https://govnokod.ru/29002 https://govnokod.xyz/_29002
#208: https://govnokod.ru/29060 https://govnokod.xyz/_29060
#209: https://govnokod.ru/29070 https://govnokod.xyz/_29070

nepeKamHblu_nemyx nepeKamHblu_nemyx, (Updated )

Комментарии (483, +483)

Яuбy / Говнокод #29078 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
# https://www.source-code.biz/snippets/vbasic/9.htm
    def calc_probability_of_inverse_normal_cumulative_distribution(probability)
      raise Math::DomainError unless probability.instance_of? BigDecimal

      a1 = -39.6968302866538
      a2 = 220.946098424521
      a3 = -275.928510446969
      a4 = 138.357751867269
      a5 = -30.6647980661472
      a6 = 2.50662827745924
      b1 = -54.4760987982241
      b2 = 161.585836858041
      b3 = -155.698979859887
      b4 = 66.8013118877197
      b5 = -13.2806815528857
      c1 = -7.78489400243029E-03
      c2 = -0.322396458041136
      c3 = -2.40075827716184
      c4 = -2.54973253934373
      c5 = 4.37466414146497
      c6 = 2.93816398269878
      d1 = 7.78469570904146E-03
      d2 = 0.32246712907004
      d3 = 2.445134137143
      d4 = 3.75440866190742
      probability_low = 0.02425
      probability_high = 1 - probability_low

      raise Math::DomainError if probability <= 0 || probability >= 1

      # glhf to the person who's gonna refactor this
      # rubocop:disable Layout/LineLength
      if probability < probability_low
        q = (-2 * Math.log(probability))**0.5
        (((((((((((c1 * q) + c2) * q) + c3) * q) + c4) * q) + c5) * q) + c6) / ((((((((d1 * q) + d2) * q) + d3) * q) + d4) * q) + 1)).to_f
      elsif probability <= probability_high
        q = probability - 0.5
        r = q * q
        (((((((((((a1 * r) + a2) * r) + a3) * r) + a4) * r) + a5) * r) + a6) * q / ((((((((((b1 * r) + b2) * r) + b3) * r) + b4) * r) + b5) * r) + 1)).to_f
      else
        q = (-2 * Math.log(1 - probability))**0.5
        (-((((((((((c1 * q) + c2) * q) + c3) * q) + c4) * q) + c5) * q) + c6) / ((((((((d1 * q) + d2) * q) + d3) * q) + d4) * q) + 1)).to_f
      end
      # rubocop:enable Layout/LineLength
    end

красота.

автор: аспирант-физик.

Shannarra_ Shannarra_, (Updated )

Комментарии (4, +4)