Skip to content

Instantly share code, notes, and snippets.

View mandarjog's full-sized avatar

Mandar U Jog mandarjog

  • ex-google
  • Mountain View, CA
View GitHub Profile
@mandarjog
mandarjog / uint.c
Created October 23, 2013 03:16
Testing with unsigned int
#include <stdio.h>
unsigned int sub(unsigned int previous, unsigned int next)
{
unsigned int res = 0xffffffff;
unsigned int diff = (next - previous);
res += diff;
res += 1;
// This code performs the following
@mandarjog
mandarjog / janus_capture.txt
Last active December 27, 2015 17:19
Janus Error Message
# cd /opt/demo400ap/scripts/# python ./demoMenu.py
400AP Demonstration (v2.1)
1)Edit demo configuration file (nano)
2)Open terminal to send AT commands (microcom)
3)Start GPS demo (demoGps.py)
4)Start a PPP connection (demoPPP.py start)
5)Stop a PPP connection (demoPPP.py stop)
6)Start router (demoRouter.py start)
7)Stop router (demoRouter.py stop)
@mandarjog
mandarjog / gist:8fd59b7dd44e7b081f80
Last active August 29, 2015 14:04
Find the closest matches between predicted set and the truth set

This problem aims to find the accuracy of an appliance detection algorithm

Setup:

We are given whole home energy data and a truth set of appliances defined by their wattage in Kilo Watts (kW)

Example:

A home has a fridge (200W), an electric vehicle (1500W) and a dryer (5000W) -->

truth set  [ 0.2, 5.0, 1.5 ]
@mandarjog
mandarjog / gist:2bba8a7e2540fbd77bb4
Last active August 29, 2015 14:17
PlaneWeather

Background

The expected weather conditions along the planned route of a plane are essential for a pilot. As a pilot I would like to have a web application that gives me this forecast at a requested granularity.

Problem Definition

Given a source, a destination and a time of departure create a weather forecast report for the journey.

Inputs

@mandarjog
mandarjog / update_opsmanager_hostname.sh
Created April 22, 2016 14:34
After a 1.7+ opsmanager restarts with a new ip address, this script will update it in the database
#!/bin/bash
# After a 1.7+ opsmanager restarts with a new ip address
# ssh into the opsmanager as 'ubuntu' and
# Run this file from the opsmanager as follows
# sudo su -l postgres < thisfile.sh >
# Get the current public ip or hostname from aws metadata
HN=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
{
"whitelist": [ "10.128.0.2", "10.128.0.3", "10.128.0.3/24", "10.200.2.0/24", "10.0.0.0/8" ]
}
@mandarjog
mandarjog / cfg.yml
Last active October 21, 2016 23:00
config
_EVERY_SERVICE_: # Applies to every interaction:- between all consumers and producers
serviceid: _EVERY_SERVICE_
ingress:
reporters:
- kind: statsd
params:
addr: "statsd:8125"
- kind: prometheus
- kind: mixologist.io/consumers/logsAdapter
params:
@mandarjog
mandarjog / cfg3.yml
Last active November 29, 2016 08:12
ServerConfig WIP1
# vim: ts=2:sw=2
version: "2202"
owner: cluster_admin
cluster:
rules:
# selector * can be omitted
# for particular selector downstream
- selector: "*"
aspects:
factProviders:
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@mandarjog
mandarjog / AccessLogAspect.go
Created December 12, 2016 23:23
AccessLogAspect
type (
AccessLogConfig struct {
// labels needed by this access Log entry
Attributes []string
// Template is implementation dependant
// For example textTemplate is " ${user.name} ${request.size}"
// it could also be the name of a protobuf
Template interface{}
}