Skip to content

Instantly share code, notes, and snippets.

View SudhakarReddyPeddinti's full-sized avatar

SudhakarReddy SudhakarReddyPeddinti

  • University of Missouri - Kansas City
  • Kansas City, MO
View GitHub Profile
@SudhakarReddyPeddinti
SudhakarReddyPeddinti / memory_profiler.log
Created November 26, 2016 21:07
Python program memory profiler
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
137 13.9 MiB 0.0 MiB @profile(stream=fp)
138 def floydWarshall(EdgeGraph):
139 # Initialize the edge weights to distances.
140 13.9 MiB 0.0 MiB for u in range(n):
141 13.9 MiB 0.0 MiB for v in range(n):
142 13.9 MiB 0.0 MiB distance[u][v] = EdgeGraph[u][v]
@SudhakarReddyPeddinti
SudhakarReddyPeddinti / ShortestPathWithG[i,j]Weights
Created November 26, 2016 20:14
Shortest path recalculation with G[i][j] as edge weights to observe the impact.
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Floyd Warshall shortest path distances:
0 7 9 7 13 9
12 0 5 13 9 3
7 9 0 8 4 6
9 4 2 0 6 7
3 5 10 10 0 8
15 5 8 10 12 0
var l = List(34, 32, 132, 352) // Scala List
l.foreach{i =>
val data:DataFrame = DataContainer.getDataFrame(i) // get DataFrame
val x = new MyClass(data) // initialize MyClass with new Object
x.setSettings(...)
x.calcSomething()
x.saveResults() // writes the Results into another Dataframe that is saved to HDFS
}
@SudhakarReddyPeddinti
SudhakarReddyPeddinti / SQL
Created August 20, 2016 17:19
STD calculation, Copy average values into other table - MySql
// Calculate Average time of Dealers
SELECT DealerID, AVG(ResponseTime) Average FROM DealerUserResponseTime GROUP BY DealerID;
// Insert Average values into other table
INSERT INTO AverageDealerResponseTime SELECT DealerID,AVG(ResponseTime) Average FROM DealerUserResponseTime GROUP BY DealerID;
// Calculate STD of Dealer Response time
SELECT FORMAT(STD(Average),2) FROM AverageDealerResponseTime;
@SudhakarReddyPeddinti
SudhakarReddyPeddinti / Jersey-CORS.xml
Last active July 18, 2016 00:02
cross-origin allow * for Jersey 1.9
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>