Skip to content

Instantly share code, notes, and snippets.

View pramodvspk's full-sized avatar

Pramod Sripada pramodvspk

  • Bloomington, IN
View GitHub Profile
@pramodvspk
pramodvspk / BatchJob.scala
Created June 1, 2017 13:08
Spark Batch Job using Type Safe Config
object BatchJob {
def main(args: Array[String]): Unit = {
SparkUtils.setupLogging()
val sparkProps = config.Settings.SparkProps
val executionMode = args(0) match {
case dev => sparkProps.devExecutionMode
case cluster => sparkProps.clusterExecutionMode
}
@pramodvspk
pramodvspk / settings.scala
Created June 1, 2017 13:07
Settings for using TypeSafeConfig
package config
import com.typesafe.config.ConfigFactory
/**
* Created by Pramod on 6/1/2017.
*/
object Settings {
private val config = ConfigFactory.load()
@pramodvspk
pramodvspk / application.conf
Created June 1, 2017 13:04
Type Safe Config usage
// Encapsulate all related properties into separate key words
sparkproperties{
dev.executionmode = "local[*]"
cluster.executionmode = "yarn-client"
}
class Post(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
description = models.CharField(max_length=1000)
image = models.ImageField(null=True)
'''
https://docs.djangoproject.com/en/1.10/topics/db/examples/many_to_many/
https://docs.djangoproject.com/en/dev/topics/db/queries/#backwards-related-objects
http://stackoverflow.com/questions/2642613/what-is-related-name-used-for-in-django
@pramodvspk
pramodvspk / rightSideView.java
Created March 14, 2017 22:25
Printing right side view of a Binary Tree
public List<Integer> rightSideView(TreeNode root) {
if(root==null) return new ArrayList();
/*Initializing a ArrayList to return*/
List<Integer> returnList = new ArrayList<Integer>();
/*Initializing a Queue to hold elements*/
Queue<TreeNode> q = new LinkedList<TreeNode>();
/*Creating a dummy variable*/
TreeNode current = null;
/*Adding the root and null into the Queue*/
q.add(root);
@pramodvspk
pramodvspk / sparkSQL.py
Created October 9, 2016 01:47
Benchmarking the run time of SQL queries on sql engine and Big Data systems
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext, Row
#Setting the application name and creating the spark context and sql context objects.
conf = SparkConf().setAppName("SparkSQL")
sc = SparkContext(conf = conf)
sqlContext = SQLContext(sc)
#The URL where the mysql database is hosted
jdbcUrl = 'jdbcUrl'
@pramodvspk
pramodvspk / musicAnalysis.ipynb
Last active October 8, 2016 19:03
Analysis of streaming music data using Apache Spark
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

TIC TAC TOE

Implementation of Tic Tac Toe game using JavaScript. The underlying artificial intelligence algorithm is MinMax .

A Pen by Pramod Sripada on CodePen.

License.