- 1
- 2
- 3
- 4
- 5
- 6
static int dh_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
return
ossl_ffc_params_cmp(&a->pkey.dh->params, &a->pkey.dh->params,
a->ameth != &ossl_dhx_asn1_meth);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 35
−9
static int dh_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
return
ossl_ffc_params_cmp(&a->pkey.dh->params, &a->pkey.dh->params,
a->ameth != &ossl_dhx_asn1_meth);
}
Ну и где здесь вулн?
−4
(define A (list 1 2 3 4 5 6))
(define (filter number first-number)
(cond ((= (modulo first-number 2) 0)
(cond ((= (modulo number 2) 0) (list number))
(else '())))
(else (cond ((not (= (modulo number 2) 0)) (list number))
(else '())))))
(define (same-parity-impl L n)
(let ((C (cdr L)))
(cond ((null? C)
(filter (car L) n))
(else
(append
(filter (car L) n)
(same-parity-impl C n))))))
(define result (same-parity-impl A (car A)))
(newline)
(display result)
(newline)
Смотрите, что я сделал!
−4
import java.lang.Math;
import java.util.Random;
public class MyVector {
public static MyVector[] generateVectors(int N) {
MyVector[] generated_vectors = new MyVector[N];
for (int i = 0; i < N; i++) {
MyVector vec = new MyVector();
generated_vectors[i] = vec;
}
return generated_vectors;
}
public MyVector(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public MyVector() {
final Random random = new Random();
this.x = random.nextInt();
this.y = random.nextInt();
this.z = random.nextInt();
}
public double getX() { return this.x; }
public void setX(double newX) { this.x = newX; }
public double getY() { return this.y; }
public void setY(double newY) { this.y = newY; }
public double getZ() { return this.z; }
public void setZ(double newZ) { this.z = newZ; }
public double getLength() {
return Math.sqrt(Math.pow(this.x, 2) +
Math.pow(this.y, 2) +
Math.pow(this.z, 2));
}
public String toString() {
StringBuilder representation = new StringBuilder();
representation.
append(" { ").
append(this.x).
append(" ; ").
append(this.y).
append(" ; ").
append(this.z).
append(" } ");
return representation.toString();
}
public double scalarProduct(MyVector vec) {
return (this.getX() * vec.getX() +
this.getY() * vec.getY() +
this.getZ() * vec.getZ());
}
public MyVector vectorProduct(MyVector vec) {
MyVector result = new MyVector();
result.setX(this.getY() * vec.getZ() -
this.getZ() * vec.getY());
result.setY(this.getZ() * vec.getX() -
this.getX() * vec.getZ());
result.setZ(this.getX() * vec.getY() -
this.getY() * vec.getX());
return result;
}
public MyVector substract(MyVector vec) {
MyVector result = new MyVector();
result.setX(this.getX() - vec.getX());
result.setY(this.getY() - vec.getY());
result.setZ(this.getZ() - vec.getZ());
return result;
}
public MyVector add(MyVector vec) {
MyVector result = new MyVector();
result.setX(this.getX() + vec.getX());
result.setY(this.getY() + vec.getY());
result.setZ(this.getZ() + vec.getZ());
return result;
}
private double x;
private double y;
private double z;
}
Что здесь не так?
−1
(define A (list 1 2 3 4 5))
(define (reverse L)
(let ((C (cdr L)))
(if (not (null? C))
(cons (reverse C) (car L))
(car L))))
(newline)
(display (reverse A))
(newline)
Почему у меня получается х****й лист после реверсинга? :-(
0
curl -fsSL https://deno.land/x/install/install.sh | sh
Хи-хи-хи
0
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main ()
{
char address[128], fname[128], command[128];
FILE *tempfile;
strcpy(fname , tmpnam(NULL));
tempfile = fopen (fname, "w"); /* create temporary file */
if (tempfile == NULL) /* error - didn't create file */
{
printf("Internal failure #1 please report %d\n", errno);
exit (1);
}
fprintf(tempfile, "Thank you very much for caring about our cause\n");
fprintf(tempfile, "this letter is just to tell you how much we\n");
fprintf(tempfile, "really think you are wonderful for caring.\n\n");
fprintf(tempfile, "Sincerely,\n\n");
fprintf(tempfile, "Jane Doe, Executive Thanker\n");
fclose (tempfile);
gets(address); /* read in email address */
sprintf(command, "mail -s \"thanks for caring\" %s < %s\n",
address, fname); /* create the command */
system (command); /* execute command */
remove (fname); /* clean up */
exit (0);
}
Игра: найди вулна.
0
https://career.habr.com/vacancies?s[]=2&s[]=3&s[]=82&s[]=4&s[]=5&s[]=72&s[]=1&s[]=75&s[]=6&s[]=77&s[]=7&s[]=83&s[]=84&s[]=8&s[]=85&s[]=73&s[]=9&s[]=86&s[]=106&type=all
Что бы это могло значить...
0
#!/usr/bin/guile -s
!#
(define (pt n s)
(cond ((< n 1) 0)
((= n 1) 1)
((= s 0) 0)
((= s 1) 1)
((= s n) 1)
((> s n) 0)
(else (+ (pt (- n 1) s) (pt (- n 1) (- s 1))))))
(display (pt 1 1)) ;; 1
(newline)
(display (pt 3 2)) ;; 2
(newline)
(display (pt 5 3)) ;; 6
(newline)
Лисп-загадка: угадайте, что делает этот (вышеприведённый) код.
0
#!/usr/bin/guile -s
!#
(define (square x)
(* x x))
(define (square_sum x y)
(+ (square x) (square y)))
(define (tmax x y z)
(cond ((and (>= x y) (>= x z)) x)
((and (>= y x) (>= y z)) y)
(else z)))
(define (tms x y z)
((cond ((= (tmax x y z) x)
(if (> y z)
(square_sum x y)
(square_sum x z)))
((= (tmax x y z) y)
(if (> x z)
(square_sum x y)
(square_sum y z)))
((= (tmax x y z) z)
(if (> x y)
(square_sum x z)
(square_sum y z)))
(else 0))))
(display "Ans: ")
(display (tms 6 5 4))
(newline)
Почему не работает?
0
;; Sound.
(xbindkey '(Alt F7) "amixer set Master 1%-")
(xbindkey '(Alt F8) "amixer set Master 1%+")
(define muted 0)
(run-command "amixer set Master 3%")
(xbindkey-function '(Alt F6)
(lambda()
(cond ((equal? muted 0)
(run-command "amixer set Master 0%")
(set! muted 1)
)
(else (begin
(run-command "amixer set Master 3%")
(set! muted 0)
))
;; какой багор
)))
Линукс-загадка!