Skip to content

Instantly share code, notes, and snippets.

@yar
yar / main.yml
Last active September 7, 2019 19:40
Ansible role for the servers
- name: Set Europe/Moscow timezone
timezone: name=Europe/Moscow
become: yes
# Comment this out after the first run
- name: Upgrade all default packages
apt:
upgrade: yes
update_cache: yes
@yar
yar / concat_overlapping_video_framemd5_demuxer.py
Last active August 22, 2018 21:09
Concat video files that overlap in time using the framemd5 and demuxer method
# Usage: ffmpeg $(( echo input1.mp4; echo input2.mp4 ) | python3 concat_overlapping_video_framemd5_demuxer.py concat_file.txt) -y -an output.mp4
import os
import sys
import subprocess
ffmpeg_concat_file, md5_last_frame = open(sys.argv[1], 'w'), None
for video_path in map(os.path.abspath, list(map(str.strip, sys.stdin))):
framemd5 = subprocess.check_output(['ffmpeg', '-nostats', '-hide_banner', '-i', video_path, '-an', '-f', 'framemd5', '-c', 'copy', '-'], stderr = open(os.devnull, 'w'))
inpoint, tb_num, tb_den = 0, 1, 1
@yar
yar / run-in-console.js
Last active June 1, 2016 23:51
Reveal full talk descriptions on the pages listing videos at confreaks.tv
Array.prototype.filter.call(document.getElementsByClassName('video-abstract-preview'), function(el) { el.style.height = 'auto'; });
@yar
yar / gist:10023078
Last active August 29, 2015 13:58
Simple GIT usage for tracking changes in an important local file

Simple GIT usage for tracking changes in an important local file

Preparation (just once)

  • Install homebrew: http://brew.sh

  • Update homebrew. For that, in terminal, run:

brew update
@yar
yar / gist:6192861
Created August 9, 2013 11:10
batch-renaming files like 254--08.00-08.30--Комиссия.mp4 to 20c6655a-4b0d-11e1-8a16-001999c6cab9/1330833600-1330835400.mp4
require 'json'
# batch-renaming files like
# 254--08.00-08.30--Комиссия.mp4
# to
# 20c6655a-4b0d-11e1-8a16-001999c6cab9/1330833600-1330835400.mp4
#
File.read("spec/sample_files/json_results.txt").lines.map do |line|
JSON.parse(line)
end.sort_by { |json| json["video_start"] }.each do |json|
@yar
yar / gst-plugins-ugly.patch
Created August 9, 2012 12:53
gst-plugins-ugly patch
diff --git a/Library/Formula/gst-plugins-ugly.rb b/Library/Formula/gst-plugins-ugly.rb
index bad2771..c0ca39e 100644
--- a/Library/Formula/gst-plugins-ugly.rb
+++ b/Library/Formula/gst-plugins-ugly.rb
@@ -34,7 +34,7 @@ class GstPluginsUgly < Formula
depends_on 'x264' => :optional
def install
- ENV.append "CFLAGS", "-no-cpp-precomp -funroll-loops -fstrict-aliasing"
+ ENV.append "CFLAGS", "-no-cpp-precomp -funroll-loops -fstrict-aliasing -I/usr/local/include/opencore-amrnb -I/usr/local/include/opencore-amrwb"