Skip to content

Instantly share code, notes, and snippets.

View vietkute02's full-sized avatar
:octocat:
hard working on video streaming platform

Luu Viet Anh vietkute02

:octocat:
hard working on video streaming platform
  • Thudo jsc
  • Ha Noi, Viet Nam
View GitHub Profile
import os
import time
import random
import argparse
def create_random_files(folder_path, num_files, min_size, max_size):
open_times, write_times, close_times = 0, 0, 0
for i in range(1, num_files + 1):
@vietkute02
vietkute02 / 2021032423master.mpd
Last active March 29, 2021 07:03
dash catchup
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:mpeg:dash:schema:mpd:2011"
xmlns:cenc="urn:mpeg:cenc:2013"
xmlns:mspr="urn:microsoft:playready"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
profiles="urn:mpeg:dash:profile:isoff-live:2011"
type="dynamic"
minimumUpdatePeriod="PT6S"
@vietkute02
vietkute02 / livestreamDetail.json
Last active December 3, 2020 06:52
livestream detail
{
"ec":0,
"data":{
"id":"5fc8673ddcae0a001b9b0839",
"livestreamUrl":"http://staticlivegw.mocha.com.vn/origin/playlist/5fc8673ddcae0a001b9b0839/master.m3u8",
"description":"",
"name":"viettel livestream - 2020-12-03",
"accountId":"viettel",
"duration":8907,
"heath":"acceptable",
@vietkute02
vietkute02 / recoverMediaError.js
Created August 31, 2019 08:50
recover media error in hls
video.addEventListener('error', handleVideoEvent);
function handleVideoEvent(evt) {
let data = '';
switch(evt.type) {
case 'error':
data = Math.round(evt.target.currentTime*1000);
if(evt.type === 'error') {
let errorTxt, mediaError=evt.currentTarget.error;
./objs/srs.master.log:15031:[2019-05-31 19:55:24.591][trace][8008][2467] <- CPB time=0, okbps=1,0,0, ikbps=2178,0,0, mr=0/350, p1stpt=20000, pnt=300000
./objs/srs.master.log:15113:[2019-05-31 20:00:25.069][trace][8008][2486] <- CPB time=0, okbps=1,0,0, ikbps=2067,0,0, mr=0/350, p1stpt=20000, pnt=300000
./objs/srs.master.log:15183:[2019-05-31 20:05:25.069][trace][8008][2486] <- CPB time=19734, okbps=0,0,0, ikbps=2003,1783,2013, mr=0/350, p1stpt=20000, pnt=300000
./objs/srs.master.log:15433:[2019-05-31 20:12:14.293][trace][8008][2553] <- CPB time=0, okbps=1,0,0, ikbps=1598,0,0, mr=0/350, p1stpt=20000, pnt=300000
./objs/srs.master.log:15491:[2019-05-31 20:12:55.229][trace][8008][2566] <- CPB time=0, okbps=1,0,0, ikbps=1781,0,0, mr=0/350, p1stpt=20000, pnt=300000
./objs/srs.master.log:15653:[2019-05-31 20:16:24.460][trace][8008][2602] <- CPB time=0, okbps=1,0,0, ikbps=1987,0,0, mr=0/350, p1stpt=20000, pnt=300000
./objs/srs.master.log:15731:[2019-05-31 20:17:47.600][trace][8008][2618] <- CPB time=0, okbps=1,0,0, i
// ...
function checkBelongsTo(installationId, userId, cb) {
Installation.findById(installationId, function (err, inst) {
cb(err, !err && inst && inst.userId == userId);
});
}
var ERR_403 = new Error("Forbidden");
ERR_403.status = ERR_403.statusCode = 403;
{
"_id" : ObjectId("547c29516123c77416c14cf8"),
"logs" : {
"12" : {
"type" : 131,
"msg" : {
"big" : 10,
"small" : 5,
"card" : {
"117700" : [
@vietkute02
vietkute02 / hand.js
Created November 19, 2014 09:10
Hand
function Hand(cards) {
this.cards = cards.map(function(card) { return new Card(card); });
this.sortCards();
this.organized = this.organizeHand();
}
Hand.prototype.sortCards = function() {
this.cards.sort(function(a, b) {
return a.getValue() - b.getValue();
});
@vietkute02
vietkute02 / gist:d11b4209854d59a9feb3
Created October 31, 2014 02:18
add ssh key to remote host
#!/bin/bash
# Variables
USER_AND_HOST=$1
line="---------------------------------------------"
echo "REGISTERING RSA PUBLIC KEY WITH HOST: $REMOTE_HOST"
echo $line
@vietkute02
vietkute02 / install.sh
Last active August 29, 2015 14:07 — forked from solar/install.sh
#!/usr/local/bin/zsh
version="3.4.4"
priority="30404"
sudo mkdir -p /var/log/zookeeper /usr/local/zookeeper /var/zookeeper
curl -L http://ftp.kddilabs.jp/infosystems/apache/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz | tar zx
sudo cp -r zookeeper-${version} /usr/local/zookeeper/${version}
sudo cp ./zookeeper.sh /usr/local/zookeeper/
sudo cp ./zoo.cfg /etc/