Skip to content

Instantly share code, notes, and snippets.

View tr4n2uil's full-sized avatar
💻
Architecting the future

Vibhaj Rajan tr4n2uil

💻
Architecting the future
View GitHub Profile
slids = []
hash = {"not_working_users"=>0, "all_users" => 0, "error_messages" => 0, "ice_connection_failure"=>0, "not_connected_to_peer" => 0, "signal_did_not_get_client" => 0, "reconnect_with_data" => 0, 'reconnect_no_speed' => 0, 'reconnect_no_data_channel' => 0, 'server_not_connected' => 0, "no_logs" => 0, "doesn't_work_always" => 0}
all_users = []
not_working_users = []
SummaryLog.where("webrtc_state=3 and region='eu-west-1' and user_browser='firefox' and created_at between '2014-12-17' and '2014-12-18'").each do |sl|
content=`curl -s -u "admin:Ch0c0lat3s" -H "Content-Type: application/json" -H "Accept: application/json" "http://templog.browserstack.com/logs_json?live_session_id=#{sl.session_id}"`.strip
logs = JSON.parse(content)
messages = logs.map{|x| x["message"]}
if !(messages.include?("terminal_connected") || messages.include?("signalling_offer"))
hash['server_not_connected'] += 1
(with-db "20150123"
(def reconnects (get-sessions {:message {$in ["client_reconnecting", "client_reconnecting_with_data"]} "json_data.clientBrowser" "chrome"}))
(defn msg-counter [msgs collections] (map (fn [sid] (hash-map :s sid :rc (count-occurances {:message {$in msgs}} sid))) collections))
(defn reconnects-n [n] (map :s (filter #(= 1 (:rc %)) (msg-counter ["client_reconnecting", "client_reconnecting_with_data"] reconnects))))
(def reconnects-1 (reconnects-n 1))
; reconnects single
(with-db "20150205"
(def reconnects (get-sessions {:message {$in ["client_reconnecting", "client_reconnecting_with_data"]} "json_data.clientBrowser" "chrome"}))
(defn msg-counter [msgs collections] (map (fn [sid] (hash-map :s sid :rc (count-occurances {:message {$in msgs}} sid))) collections))
(defn reconnects-n [n] (map :s (filter #(= n (:rc %)) (msg-counter ["client_reconnecting", "client_reconnecting_with_data"] reconnects))))
@tr4n2uil
tr4n2uil / gist:e686f62105aea4d1a2dd
Created February 12, 2015 12:32
fallback_stats.clj
(defn fallback-stats [d b] (with-db d
(def old-buckets buckets)
(def browser (if (= b "chrome") chrome? (complement chrome?)))
(defn div [bucket query] (filter (partial query) bucket))
(defn sub [bucket res] (clojure.set/difference (set bucket) (set res)))
@tr4n2uil
tr4n2uil / intern-parallel.js
Last active March 31, 2016 15:24
Make functionalSuites in intern run in parallel. Just put this file alongside intern.js and replace "intern!object" in your functional test files with "tests/intern-parallel"
define([
'intern!object',
'intern/chai!assert',
'require',
'intern/dojo/node!leadfoot/Command',
'intern/dojo/Promise',
'./intern'
], function (registerSuite, assert, require, Command, Promise, config, registry) {
var parallelRegister = function (descriptor) {
var test;
var http = require('http');
var agent;
if(process.version.substring(0,5) == 'v0.10'){
var AgentKeepAlive = require('agentkeepalive');
agent = new AgentKeepAlive({
keepAliveTimeout: 30*1000
});
}
else {