Skip to content

Instantly share code, notes, and snippets.

View Dimanaux's full-sized avatar

Dmitry Barskov Dimanaux

View GitHub Profile
#include <stdio.h>
void init_encode_context(AVCodecContext* encode_context) {
ctxEncode = avcodec_alloc_context();
ctxEncode->coder_type = 0; // coder = 1
ctxEncode->flags |=CODEC_FLAG_LOOP_FILTER; // flags=+loop
ctxEncode->me_cmp |= 1; // cmp=+chroma, where CHROMA = 1
ctxEncode->partitions |= X264_PART_I8X8+X264_PART_I4X4 + X264_PART_P8X8 + X264_PART_B8X8; // partitions=+parti8x8+parti4x4+partp8x8+partb8x8
ctxEncode->me_method = ME_HEX; // me_method=hex
public class Main {
// declaration: int x;
// initialization: x = 4;
// int x = 4;
public static void main(String[] args) {
int[] array = new int[] {1, 2, 3, 4, 5, 1};
// 1 <= x <= 100; where x from array
// E = exists - if 0 exists in the array
(define (density symbol)
(list-ref
(list 0 (/ 25 100) (/ 55 100) (/ 80 100) (/ 100 100))
symbol))
(define (next-section a b i)
(let ([l (- b a)])
(cons
(+ a (* l (density (- i 1))))
(+ a (* l (density i))))))
class CollectionDecorator
def self.page(objects_relation, page = 1)
CollectionDecorator.new(objects_relation.order("created_at").page(page))
end
def initialize(objects_relation)
@objects_relation = objects_relation
end
include Enumerable
@Dimanaux
Dimanaux / 00.md
Last active October 29, 2019 20:38

Bugs for dumb.exe

1. При уменьшении размера окна, размер и расположение элементов не меняется, появляются полосы прокрутки

Severity: High

Шаги:

- Запустить приложение, создать новый файл
- Уменьшить размер окна

Ожидаемый результат: Элементы программы занимают всю площадь экрана, уменьшаются пропорционально\

@Dimanaux
Dimanaux / 00.md
Last active October 18, 2019 12:19

При сохранении файла заголовок окна не меняется

ID: 8
Severity: Medium
Версия ListBoxer: 1.89
Модуль: Работа с файлами
01.png
Шаги:

1. Открыть ListBoxer
  1. Добавить элементы в список
@Dimanaux
Dimanaux / Main.java
Created October 14, 2019 14:01
Long arithmetics example, + and * for natural numbers.
import java.util.Scanner;
/**
* Natural numbers here are represented by byte arrays.
* They are stored reversed. Each byte represents decimal digit
* of the number. E. g. 456 = {6, 5, 4}
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
@Dimanaux
Dimanaux / .bashrc
Last active August 20, 2019 05:43
My PS1
export PS1="\[\033[92m\]\u\[\033[00m\]:\[\033[34m\]\w\[\033[00m\]\[\033[31m\] \$(__git_ps1 '(%s)')\[\033[00m\]$ "
@Dimanaux
Dimanaux / HowToFightSpringSecurity.java
Created June 18, 2019 17:17
May be it is an OOP solution
class Account {
private String email;
private String password;
// single method
public UserDetails asDetails() {
return new AccountDetails() {
@Override public String getPassword() {
return Account.this.password;
}
import java.util.LinkedList;
import java.util.List;
public class AbstractFactorySample {
public static void main(String[] args) {
String uname = System.getProperty("os.name").toLowerCase();
Application application;
if (uname.contains("windows")) {