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

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
for ($i = 0; $i < 1; $i++) {
            $images[] = [
                "noRetina" => [
                    "thumb" => BsHelper::imageUrl($productImages[0]["image"], 50, 50),
                ],
                "retina" => [
                    "thumb" => BsHelper::imageUrl($productImages[0]["image"], 100, 100),
                ],
            ];
        }

volodyahome volodyahome, (Updated )

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

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

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
Ранее, полемизируя с пархатыми разных возрастов и ориентаций, я никак не мог взять в толк, отчего индивид,
 столь хорошо шпрохающий по-русише, с типичным, вроде бы, мышлением и при этом не украинец, 
толерантен к оскорблениям, кои несомненно были бы весьма обидны русской душе.

Теперь-то я понимаю. Еврейский душок все крепче.

Отрадно, что по крайней мере, на говнокоде он постепенно выветривается.

doomginho doomginho, (Updated )

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

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

0

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

#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
#210: https://govnokod.ru/29079 https://govnokod.xyz/_29079
#211: https://govnokod.ru/29092 https://govnokod.xyz/_29092

nepeKamHblu_nemyx nepeKamHblu_nemyx, (Updated )

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

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

0

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

#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
#210: https://govnokod.ru/29079 https://govnokod.xyz/_29079

nepeKamHblu_nemyx nepeKamHblu_nemyx, (Updated )

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

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

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
extern char* strcat( char* dest, const char* src );
extern int   printf ( const char * restrict format, ... );
extern int   putchar( int ch );

#define LISPER(n, l, re) ({                                                                                                     \
                auto int ii = l;                                                                                                          \
                static unsigned char n[l];                                                                                      \                           
                while (ii--) {                                                                                                             \
                    *str##n(n, (unsigned char[]){0x09 >> 1 << 1, 0x1911 >> 0xD});                \
                };                                                                                                                               \
                *((void**)&re) = printf((unsigned char[]){0x25, 0x73, 0x1917 >> 0xE}, n); \
                })

struct bombitterLemon{
    union {
        unsigned char   : 0;
        unsigned char   : 0;
        unsigned char v: 7;
    } pacific;
};

int main(void) {

    struct bombitterLemon b0; 

    LISPER(cat, 0x40 ^ (2 << 2), b0);
    (*putchar) (*(struct wtf**)&b0);
    LISPER(cat, ((int) (((char*)   (0x8 ^ (1 << 6))) - 3) | 1), b0);
    (**putchar) (*(struct is***)&b0);
    LISPER(cat, ((int) (((short*)  (0x9 << 3))) | 4), b0);
    (***putchar) (*(struct that****)&b0);
    LISPER(cat, ((int) (((int*)    (0x12 << 2))) | 4), b0);
    (**putchar) (*(unsigned char*****)&b0);
    LISPER(cat, ((int) (((long*)   (0x90 >> 1))) | 4 | 2 | 1), b0);
    (*putchar) (b0.pacific.v);

}

Классический собесный говнокод для кунов на громкие позиции malware ANALyst, security дрист-searcher и даже (о, ужас) compiler devteam в известные шарашки.
Шланг<15 и ICC жуют с говном не глядя. Чего не сказать о бычаре, дристающего на коврик.
Осилил, анонимус? Поясни пацанам на пальцах за высер без единого include с ноября прошлого.

Dulldonch1k Dulldonch1k, (Updated )

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

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

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
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
  70. 70
  71. 71
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
  81. 81
  82. 82
  83. 83
  84. 84
  85. 85
  86. 86
  87. 87
  88. 88
  89. 89
  90. 90
  91. 91
void main() {
    ph_fork f1, f2, f3, f4, f5;

    f_arr[0] = &f1;
    f_arr[1] = &f2;
    f_arr[2] = &f3;
    f_arr[3] = &f4;
    f_arr[4] = &f5;

    philosopher ph1, ph2, ph3, ph4, ph5;

    ph_arr[0] = &ph1;
    ph_arr[1] = &ph2;
    ph_arr[2] = &ph3;
    ph_arr[3] = &ph4;
    ph_arr[4] = &ph5;

    f1.number = 1;
    sem_init(&f1.is_free, 0, 1);

    f2.number = 2;
    sem_init(&f2.is_free, 0, 1);

    f3.number = 3;
    sem_init(&f3.is_free, 0, 1);

    f4.number = 4;
    sem_init(&f4.is_free, 0, 1);

    f5.number = 5;
    sem_init(&f5.is_free, 0, 1);

    ph1.number = 1;
    ph1.ph_fork_amount = 0;
    ph1.ph_forks[0] = 1;
    ph1.ph_forks[1] = 2;
    ph1.times_eaten = 0;
    ph1.times_thought = 0;
    ph1.st = THINKING;
    pthread_create(&ph1.thread, NULL, routine, (void*)&ph1);

    ph2.number = 2;
    ph2.ph_fork_amount = 0;
    ph2.ph_forks[0] = 2;
    ph2.ph_forks[1] = 3;
    ph2.times_eaten = 0;
    ph2.times_thought = 0;
    ph2.st = THINKING;
    pthread_create(&ph2.thread, NULL, routine, (void*)&ph2);

    ph3.number = 3;
    ph3.ph_fork_amount = 0;
    ph3.ph_forks[0] = 3;
    ph3.ph_forks[1] = 4;
    ph3.times_eaten = 0;
    ph3.times_thought = 0;
    ph3.st = THINKING;
    pthread_create(&ph3.thread, NULL, routine, (void*)&ph3);

    ph4.number = 4;
    ph4.ph_fork_amount = 0;
    ph4.ph_forks[0] = 4;
    ph4.ph_forks[1] = 5;
    ph4.times_eaten = 0;
    ph4.times_thought = 0;
    ph4.st = THINKING;
    pthread_create(&ph4.thread, NULL, routine, (void*)&ph4);

    ph5.number = 5;
    ph5.ph_fork_amount = 0;
    ph5.ph_forks[0] = 5;
    ph5.ph_forks[1] = 1;
    ph5.times_eaten = 0;
    ph5.times_thought = 0;
    ph5.st = THINKING;
    pthread_create(&ph5.thread, NULL, routine, (void*)&ph5);

    pthread_join(ph1.thread, NULL);
    pthread_join(ph2.thread, NULL);
    pthread_join(ph3.thread, NULL);
    pthread_join(ph4.thread, NULL);
    pthread_join(ph5.thread, NULL);

    sem_destroy(&f1.is_free);
    sem_destroy(&f2.is_free);
    sem_destroy(&f3.is_free);
    sem_destroy(&f4.is_free);
    sem_destroy(&f5.is_free);

    printf("\nThe lunch has ended!\n--------\nRESULTS:\nPhilosopher 1 has eaten %d times and thought %d times\nPhilosopher 2 has eaten %d times and thought %d times\nPhilosopher 3 has eaten %d times and thought %d times\nPhilosopher 4 has eaten %d times and thought %d times\nPhilosopher 5 has eaten %d times and thought %d times\n", ph1.times_eaten, ph1.times_thought, ph2.times_eaten, ph2.times_thought, ph3.times_eaten, ph3.times_thought, ph4.times_eaten, ph4.times_thought, ph5.times_eaten, ph5.times_thought);
}

Решение задачи про обедающих философов, часть вторая.

GDMaster GDMaster, (Updated )

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

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

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
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
  70. 70
  71. 71
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
  81. 81
  82. 82
  83. 83
  84. 84
  85. 85
  86. 86
  87. 87
  88. 88
  89. 89
  90. 90
  91. 91
  92. 92
  93. 93
  94. 94
  95. 95
  96. 96
  97. 97
  98. 98
  99. 99
  100. 100
#include <pthread.h>
#include <stdio.h>
#include <semaphore.h>
#include <unistd.h>
typedef struct _ph_fork {
    int number;
    sem_t is_free;
} ph_fork;
typedef enum state {
    EATING,
    THINKING
} state;
typedef struct _philosopher {
    int number;
    int ph_fork_amount;
    int ph_forks[2];
    int times_eaten;
    int times_thought;
    state st;
    pthread_t thread;
} philosopher;

ph_fork* f_arr[5] = {0};
philosopher* ph_arr[5] = {0};

void* routine(void* arg) {
    philosopher* ph = (philosopher*)arg;
    int frks[2] = {0};
    frks[0] = ph->ph_forks[0];
    frks[1] = ph->ph_forks[1];
    int ph_fork_left_odd = frks[0] % 2;
    int ph_fork_right_odd = frks[1] % 2;
    printf("Philosopher %d has taken a seat at the table.\n", ph->number);
    for (int i = 0; i < 72; i++) {
        if (!(ph_fork_left_odd && ph_fork_right_odd)) {
            if (ph_fork_left_odd) {
                sem_wait(&f_arr[frks[0] - 1]->is_free);
                printf("Philosopher %d takes left fork…\n", ph->number);
                ph->ph_fork_amount++;
                sem_wait(&f_arr[frks[1] - 1]->is_free);
                printf("Philosopher %d takes right fork…\n", ph->number);
                ph->ph_fork_amount++;
            }
            if (ph_fork_right_odd) {
                sem_wait(&f_arr[frks[1] - 1]->is_free);
                printf("Philosopher %d takes right fork…\n", ph->number);
                ph->ph_fork_amount++;
                sem_wait(&f_arr[frks[0] - 1]->is_free);
                printf("Philosopher %d takes left fork…\n", ph->number);
                ph->ph_fork_amount++;
            }
        } else { // Special case when both ph_forks are odd
            sem_wait(&f_arr[frks[0] - 1]->is_free);
            printf("Philosopher %d takes left fork…\n", ph->number);
            ph->ph_fork_amount++;
            sem_wait(&f_arr[frks[1] - 1]->is_free);
            printf("Philosopher %d takes right fork…\n", ph->number);
            ph->ph_fork_amount++;
        }
        if (ph->ph_fork_amount == 2) {
            ph->st = EATING;
            ph->times_eaten++;
            printf("Philosopher %d is eating…\n", ph->number);
            sleep(1);
        };
        if (!(ph_fork_left_odd && ph_fork_right_odd)) {
            if (ph_fork_left_odd) {
                printf("Philosopher %d puts back left fork…\n", ph->number);
                sem_post(&f_arr[frks[0] - 1]->is_free);
                ph->ph_fork_amount--;
                printf("Philosopher %d puts back right fork…\n", ph->number);
                sem_post(&f_arr[frks[1] - 1]->is_free);
                ph->ph_fork_amount--;
            }
            if (ph_fork_right_odd) {
                printf("Philosopher %d puts back right fork…\n", ph->number);
                sem_post(&f_arr[frks[1] - 1]->is_free);
                ph->ph_fork_amount--;
                printf("Philosopher %d puts back left fork…\n", ph->number);
                sem_post(&f_arr[frks[0] - 1]->is_free);
                ph->ph_fork_amount--;
            }
        } else { // Special case when both ph_forks are odd
            printf("Philosopher %d puts back left fork…\n", ph->number);
            sem_post(&f_arr[frks[0] - 1]->is_free);
            ph->ph_fork_amount--;
            printf("Philosopher %d puts back right fork…\n", ph->number);
            sem_post(&f_arr[frks[1] - 1]->is_free);
            ph->ph_fork_amount--;
        }
        if (ph->ph_fork_amount == 0) {
            ph->st = THINKING;
            printf("Philosopher %d is thinking…\n", ph->number);
            ph->times_thought++;
            sleep(1);
        }
    }
    printf("Philosopher %d has finished his lunch and left.\n", ph->number);
    return NULL;
};

Решение задачи про обедающих философов, часть первая.

GDMaster GDMaster, (Updated )

Комментарии (0)

Koko / Говнокод #29088 Ссылка на оригинал

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
//Вдохновил говнокод от DypHuu_niBEHb
fun main() {
    Сорок тысяч обезъян в жопу сунули банан
}

object Сорок {
    infix fun тысяч(a: обезъян) : обезъян {
        print("${this.javaClass.simpleName} ${Thread.currentThread().stackTrace[1].methodName} ")
        return обезъян
    }
}

object обезъян {
    infix fun в(a: жопу) : жопу {
        print("${this.javaClass.simpleName} ${Thread.currentThread().stackTrace[1].methodName} ")
        return жопу
    }
}

object жопу {
   infix fun сунули(a: банан) : жопу {
       print("${this.javaClass.simpleName} ${Thread.currentThread().stackTrace[1].methodName} ${a.javaClass.simpleName}")
       return this
   }
}

object банан {
}

Сорок тысяч обезъян в жопу сунули банан

Trix Trix, (Updated )

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

Я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)