Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am biomancer on github.
  • I am biomancer (https://keybase.io/biomancer) on keybase.
  • I have a public key whose fingerprint is D100 AE89 92D9 DE2A F933 2566 CD4C 6E4B 3292 F69A

To claim this, I am signing this object:

@biomancer
biomancer / playlist_builder.rb
Created September 18, 2014 14:48
Generating i-frame and byterange m3u8 playlist from .ts video file for usage in HLS
module PlaylistBuilder
SEG_DURATION, PKT_SIZE, PKT_POS, PKT_TIME = 0,1,2,3
def self.extract_iframes_data(video_filepath)
raise "#{video_filepath} does not exists!" unless File.exists?(video_filepath)
iframes_data = []
cmd = "ffprobe -show_frames -select_streams v -of compact -show_entries packet=pts_time,codec_type,pos:frame=pict_type,pkt_pts_time,pkt_size,pkt_pos -i #{video_filepath.shellescape}"
frames_and_packets = nil
r = Benchmark.measure('') do
frames_and_packets = `#{cmd}`.split("\n")
#!/bin/bash
# Create an Iframe index from HLS segmented streams
# $1: Filename to be created
# $2: Location of segmented ts files
# Check how many arguments
if [ $# != 2 ]; then
echo "Usage: $0 [Input filename] [Location of segmented streams]"
exit 1;
fi
@biomancer
biomancer / dep_detect.rb
Last active March 20, 2017 16:04
Dirty simple order dependencies detector
## This script can be used to detect simple order dependencies if one of tests is failing when some other test(or tests, independently) is being run before it.
## Script will not give reliable results if the dependency is complex - e.g. two specific tests must be run before for affected one to fail.
## Script will refine results with each rspec run: more runs will result smaller UNSAFE lists. Files from previous script runs are used too
## Ensure that you have config.order = 'random' in RSpec.configure block .
## Running rspec with different seeds to collect data
RSPEC_RUN_COUNT = 5 #set to 0 to analyze already existing rspec_*.txt files
RSPEC_RUN_COUNT.times do
@biomancer
biomancer / 0_reuse_code.js
Created December 6, 2013 10:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@biomancer
biomancer / deploy.rb
Created July 11, 2013 10:05
Add this to deploy.rb to override default delayed_job tasks to support args per role
# This overrides default delayed_job tasks to support args per role
# If you want to use command line options, for example to start multiple workers,
# define a Capistrano variable delayed_job_args_per_role:
#
# set :delayed_job_args_per_role, {:worker_heavy => "-n 4",:worker_light => "-n 1" }
#
# Target server roles are also taken from delayed_job_args_per_role keys.
namespace :delayed_job do
def args_per_host(host)