Skip to content

Instantly share code, notes, and snippets.

View artkirienko's full-sized avatar
🌇
Working remotely @ Vancouver, Canada

Artem Kirienko artkirienko

🌇
Working remotely @ Vancouver, Canada
  • https://pressreader.com
  • Vancouver, Canada
  • 14:56 (UTC -07:00)
  • LinkedIn in/artkirienko
View GitHub Profile
@artkirienko
artkirienko / encode-mp4.txt
Created December 8, 2017 21:15
ffmpeg video compression / specifc file size
(38.5 MiB * 8192 [converts MiB to kBit]) / 260 seconds = ~1213 kBit/s total bitrate
1213 - 96 kBit/s (desired audio bitrate) = 1117 kBit/s video bitrate
38.5 * 8192.0 / (4 * 60 + 20) - 96 = 1117
ffmpeg -y -i input.mp4 -c:v libx264 -preset medium -movflags faststart -b:v 1117k -pass 1 -an -f mp4 /dev/null && \
ffmpeg -i input.mp4 -c:v libx264 -preset medium -movflags faststart -b:v 1117k -pass 2 -b:a 96k output.mp4
@artkirienko
artkirienko / subtitle-extract.txt
Created November 28, 2017 10:47 — forked from bmaeser/subtitle-extract.txt
extract subtitles from *.mkv-files on osx
lines with $ are commands
### install mkvtoolnix:
$ brew install mkvtoolnix
### list content of the mkv-file:
$ mkvmerge -i mymoviefile.mkv
### what will give you:
# require 'httpi'
# require 'crack'
require 'savon'
# p Savon.methods
client = Savon.client(
# wsdl: "https://portal.fedsfm.ru/Services/TerroristInfoService/TerroristInfoService.svc?wsdl",
wsdl: "https://portal.fedsfm.ru/Services/TerroristInfoService/TerroristInfoService.svc?singleWsdl",
# headers: {'Content-Type' => 'application/soap+xml;charset=UTF-8'},
# raise_errors: false
Нужно создать многопользовательский консольный чат (без GUI). Все пользователи чата будут находиться в едином пространстве и будут видеть сообщения от других пользователей. Помимо отправки обычных текстовых сообщений, пользователи могут отправлять команды на сервер (например, для получения количества подключенных клиентов или для изменения текущего имени пользователя). Должна быть команда help, которая возвращает информацию по другим командам.
Примерный алгоритм поведения пользователя:
Каждый клиент при входе вводит свое имя. Если имя уже занято, то клиент должен ввести другое имя.
После аутентификации клиент получает последние 100 сообщений с сервера.
Клиент может ввести сообщение, при отправке оно рассылается всем другим подключенным клиентам от его имени.
Клиент может отправить на сервер произвольную команду, и в ответ получить результат выполнения.
Основные требования:
require 'faraday'
require 'benchmark'
@conn = Faraday.new(url: 'https://www.google.com')
@threads = []
Benchmark.bm(14) do |x|
x.report('no-threads') do
8.times { @conn.get }
end
We had two distros of Oracle DB, seven forks of MySQL from different vendors,
five DVDs with MS SQL Server, a saltshaker half-full flash drive with PostgreSQL debs,
source code for a whole galaxy of FOSS databases... Including Redis, Memcached, MongoDB, Elasticsearch, and Neo4j.
Not that we needed all that for the workshop, but once you get locked into a serious data warehousing,
the tendency is to push it as far as you can. The only thing that really worried me was the SQLite.
There is nothing in the world more helpless and irresponsible and depraved than in-process embedded serverless databases,
and I knew we'd get into that rotten stuff pretty soon.
@artkirienko
artkirienko / ROR_interview_questions_middle_2016_Moscow.md
Last active February 3, 2022 19:18
Ruby on Rails interview questions

General: UNIX, HTTP/HTTPS/SSH, API, regex

• В чём разница между процессом и тредом?

• Что такое мультизадачность?

• Устройство файловой системы. Файловые дескрипторы, inode.

• Знаешь ли, что такое race condition? Сталкивался ли в реальной жизни (когда возникало и как боролся)? Когда может произойти?

Types

A type is a collection of possible values. An integer can have values 0, 1, 2, 3, etc.; a boolean can have values true and false. We can imagine any type we like: for example, a HighFive type that allows the values "hi" or 5, but nothing else. It's not a string and it's not an integer; it's its own, separate type.

Statically typed languages constrain variables' types: the programming language might know, for example, that x is an Integer. In that case, the programmer isn't allowed to say x = true; that would be an invalid program. The compiler will refuse to compile it, so we can't even run it.

@artkirienko
artkirienko / sublime_install.txt
Last active July 9, 2016 00:49
Sublime Text 3 Install
Plugins:
ctrl+`
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
ctrl shit p
lenovo:
better coffeescript
@artkirienko
artkirienko / xubuntu_install.txt
Last active July 18, 2017 15:46
Xubuntu Install
# apt update apt install
1. Install clean Xubuntu with username@password.
2. Switch on internet connection
3. Update && Upgrade
$ sudo su -
$ apt -y update && apt -y upgrade && apt -y full-upgrade