Skip to content

Instantly share code, notes, and snippets.

View olegokunevych's full-sized avatar
💻
✌🏼

Oleg Okunevych olegokunevych

💻
✌🏼
View GitHub Profile
@olegokunevych
olegokunevych / RTSP.livemd
Created December 19, 2023 18:49
Membrane RTSP -> WebRTC example

RTSP -> WebRTC

Mix.install([
  {:membrane_core, "~> 1.0"},
  {:membrane_rtsp, "~> 0.5.1"},
  {:membrane_webrtc_plugin, "~> 0.17.0"},
  {:membrane_rtc_engine,
   github: "jellyfish-dev/membrane_rtc_engine",
   ref: "49f2ba31ab65fa912f4112afe28b32cd274e14f2",
@olegokunevych
olegokunevych / docker-ctop.sh
Created August 20, 2018 14:56
ctop for docker containers
docker run --rm -ti \
--name=ctop \
-v /var/run/docker.sock:/var/run/docker.sock \
quay.io/vektorlab/ctop:latest
@olegokunevych
olegokunevych / elevator.rb
Created November 26, 2015 22:40
Elevator task quick solution
# A[weight]
# B[floor]
# M - floor limit
# X - number of people
# Y - weight limit
#
@total_result = 0
def solution(a, b, m, x, y)
require 'benchmark'
Benchmark.bm do |r|
N = 10000000
vals = [0, 1, 2]
r.report("if ") do
N.times do
current = vals.sample
if current == 0
LinkedListStack = Struct.new(:top, :pop) do
def push(value)
LinkedListStack.new(value, self)
end
def empty?
pop.nil?
end
def self.empty
@olegokunevych
olegokunevych / clockwork_kill.sh
Created March 6, 2014 13:44
Clockworks kill script
ps aux| grep -i clockwork | grep -v grep | awk '{print $2}' | xargs kill -9
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@olegokunevych
olegokunevych / custom_nginx_install.sh
Last active August 29, 2015 13:56
Compile nginx from source, include the Redis, HttpGeo, SSI modules.
sudo su
cd /opt
wget http://nginx.org/download/nginx-1.4.4.tar.gz
tar -zxvf nginx-1.4.4.tar.gz
mkdir /opt/nginx_modules
cd nginx_modules
wget https://github.com/agentzh/redis2-nginx-module/archive/v0.10.tar.gz
tar -zxvf v0.10.tar.gz
#source: https://ochronus.com/git-tips-from-the-trenches/
$ git rev-list --all | xargs git grep '<YOUR REGEX>'
$ git rev-list --all | xargs git grep -F '<YOUR STRING>'
@olegokunevych
olegokunevych / gist:8146412
Created December 27, 2013 12:35
ipfw examples
sudo ipfw pipe 1 config bw 15KByte/s
creates a pipe that only allows up to 15KB/s to go through.
Then:
sudo ipfw add 1 pipe 1 src-port 80
will attach that pipe to the outgoing traffic on port 80, effectively limiting the outgoing traffic of the web server.
sudo ipfw delete 1
will remove the pipe from the port.