Skip to content

Instantly share code, notes, and snippets.

View nipunbatra's full-sized avatar

Nipun Batra nipunbatra

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This Gist contains a collection of some useful Unix commands
Removing inplace the top of the file
@nipunbatra
nipunbatra / common_database_operations.md
Last active December 25, 2015 12:29
This Gist contains some common operations required while dealing with MySQL database

This gist contains some commonly used stuff which is easy to forget

Importing a database previously exported using mysqldump

Create a database in MySQL prompt

mysql> create database new

In the terminal, use the following command

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nipunbatra
nipunbatra / umass_redd.py
Created October 12, 2013 05:22
This script converts UMASS SMART* data into MIT REDD format.
import pandas as pd
import glob
import time
#Get all the CSVs in that folder
list_csv=glob.glob("*.csv")
#Column headers
names=['CircuitName', 'CircuitNumber', 'TimestampUTC', 'RealPowerWatts', 'ApparentPowerVAs']
channel_mapping={}
import requests
from sklearn.cluster import KMeans
#payload="select data in (now -5minutes, now) where Metadata/Extra/FlatNumber ='202' and Metadata/Extra/PhysicalParameter='PowerPhase1' and Metadata/Extra/Type='Power'"
#payload="select data in ('8/2/2013', '8/12/2013') where Metadata/Extra/FlatNumber ='902' and Metadata/Extra/PhysicalParameter='PowerPhase1' and Metadata/Extra/Type='Power'"
#r = requests.post("http://192.168.1.40:9101/api/query", data=payload)
r=requests.get("http://192.168.1.40:9102/backend/api/data/uuid/cb21f2ac-5cc4-5eb1-9b06-8e4f1dd1f7fa?starttime=1375425240000&endtime=1376289240000")
import numpy as np
import matplotlib.pyplot as plt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.