- 1
...В испании ввели уголовку за убийство крысы, проникшей в жилье.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
...В испании ввели уголовку за убийство крысы, проникшей в жилье.
Вот так-то, не то что ватный тупизм. Берегите ваших крысок!
0
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),
],
];
}
0
Ранее, полемизируя с пархатыми разных возрастов и ориентаций, я никак не мог взять в толк, отчего индивид,
столь хорошо шпрохающий по-русише, с типичным, вроде бы, мышлением и при этом не украинец,
толерантен к оскорблениям, кои несомненно были бы весьма обидны русской душе.
Теперь-то я понимаю. Еврейский душок все крепче.
Отрадно, что по крайней мере, на говнокоде он постепенно выветривается.
0
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
0
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
0
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 с ноября прошлого.
0
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);
}
Решение задачи про обедающих философов, часть вторая.
0
#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;
};
Решение задачи про обедающих философов, часть первая.
0
//Вдохновил говнокод от 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 банан {
}
Сорок тысяч обезъян в жопу сунули банан
0
# 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