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
@vietkute02
vietkute02 / gist:9680901
Created March 21, 2014 06:47
python gcm
#!/usr/bin/python
import sys, json, xmpp, random, string
SERVER = 'gcm.googleapis.com'
PORT = 5235
USERNAME = "Your GCM Sender Id"
PASSWORD = "API Key"
REGISTRATION_ID = "Registration Id of the target device"
unacked_messages_quota = 1000
/**
* Created by vietanha34 on 4/23/14.
*/
var mongoose = require("mongoose")
, Schema = mongoose.Schema
, settings = require('../../config/settings.js');
var subscriberSchema = new Schema({
username : { type : String, default : ''},
@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/
@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 / 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();
});
{
"_id" : ObjectId("547c29516123c77416c14cf8"),
"logs" : {
"12" : {
"type" : 131,
"msg" : {
"big" : 10,
"small" : 5,
"card" : {
"117700" : [
// ...
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;
./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
@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;
@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",