Skip to content

Instantly share code, notes, and snippets.

neerajnagi

Block or report user

Report or block neerajnagi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View safeSaveRDS.md
saveRDSCustom <- function(obj,fileName){
  tryCatch({
    fileConn<-file(fileName,blocking = TRUE)
    saveRDS(obj,fileConn)
    close(fileConn)
    return(TRUE)
  }
  ,error=function(e){
  cat(e)
View gist:1488f0013bc5014a95fd1496cdda8100
{"t":1479255000,"c":0}
c is a number
convert it to binary
5bit are used
1st bit : unused , always 0
2nd bit : configured
3rd bit : discovered
4th bit : connected
5th bit : recieved
@neerajnagi
neerajnagi / persistence.md
Last active Oct 3, 2016
R persistence & running stats
View persistence.md

Db

Db is a typical key-value store, key is a vector so you can track any number of metrics with various combinations

Db.new()
Db.get(Vector) 
Db.put(Vector, Object)

Stats

Stats can be used to track moments calculation over every N batches

@neerajnagi
neerajnagi / online_moment.md
Last active Oct 1, 2016
online moment algorithm
View online_moment.md

WINDOW is # of batches to be used

#define WINDOW = 24 //for 4 hours double n,m1,m2,m3,m4 //mN is Nth moment

function reset(){ n=0 m1=0 m2=0

@neerajnagi
neerajnagi / reroute.md
Last active Sep 26, 2016
datahub reroute
View reroute.md

shell access of RPI

cd ~/prophecy-gateway/src/public/js

edit function.js line 66

redis-cli
> flushall ( inside redis console)
@neerajnagi
neerajnagi / router.md
Last active Sep 13, 2016
Gauge Router
View router.md
[
  ["Custom.*", "Blower",
    ["Blower Vibration CUSTOM"]
  ],
  ["VPDB.*", "Blower", 
    ["Blower Vibration VPDB","Filter Status VPDB", "Oil Check VPDB", "Oil Overfill Indicator VPDB", "Belt Tension VPDB"]
  ],
  ["SVP.*", "Blower", 
    ["Blower Vibration SVP","Filter Status SVP", "Oil Check SVP", "Oil Overfill Indicator SVP", "Belt Tension SVP"]
@neerajnagi
neerajnagi / reason.md
Created Sep 6, 2016
gauge_error_messages
View reason.md
color       description                                                    appropriate_reason

white       machine stationary                                              Machine is idle                         
white       batch rejected                                                  Poor quality of data
white       autobaseline input missing in json                              Baseline pending 
black       non-autobaseline input missing in json                          Unexpected Error
black       R code failure,exception etc                                    Unexpected Error
black       batch missing                                                   Link Error
@neerajnagi
neerajnagi / guideline_R_model_and_input_json.md
Last active Sep 1, 2016
guidelines for R code modification w.r.t ( json input and multimodel )
View guideline_R_model_and_input_json.md

R algo will require multiple algos for a particular gauge based on model information. Also there is a frequent change in input structure of input.

To handle these things a unified json will be provided which will have following #####1) header containing machine details ( model, name, company, zone etc ) #####2) All the available statistics for all the collectors of all the subassemblies of a machines. #####3) raw data in 2d array format under collector

This will be the only input everything else will be sourced statically.

View gauge_testing.md

prerequisite

company
machineName ( svp_10 ) 
machineID (machine-a39x9d...... )
dataviewer login(  sumin1  / sumin1 ) 

Check that baseline is set for gauge if its applicable

@neerajnagi
neerajnagi / Wc.md
Last active Aug 20, 2016
Wrapper checklist
View Wc.md

supress all warning messages

options(warn=-1)

suppress all library messages

 suppressMessages(library("dplyr"))
You can’t perform that action at this time.