Beginning of my new blog

11 Jan 2018

Setting up my new blog.

Testing markdown

  1. resources: https://jekyllrb.com/docs/posts/#highlighting-code-snippets

  2. Displaying code in java


//Javascript code with syntax highlighting.
var fun = function lang(l) {
  dateformat.i18n = require('./lang/' + l)
  return true;
}
  1. Displaying code in python

#pyspark is python written API for spark
from pyspark.sql import SparkSession
spark = SparkSession.builder \
    .master(
        "spark://10.64.22.66:7077"
    ) \
    .appName(# Name of your application in the dashboard/UI                                                             
             "randomAPP"
            ) \
    .config(# Tell Spark to load some extra libraries from Maven (the Java repository)                                  
            'spark.jars.packages',
            'org.diana-hep:spark-root_2.11:0.1.13,org.diana-hep:histogrammar-sparksql_2.11:1.0.4',
            ) \
    .config('spark.cores.max',3
            ) \
    .getOrCreate()

import random
def inside(p):
  x, y = random.random(), random.random()
  return x*x + y*y < 1

#SparkContexts provide most of the "execution engine" of Spark                                                         
sc = spark.sparkContext
#One million                                                                                                           
num_samples = 1000000
count = sc.parallelize(range(0, num_samples)).filter(inside).count()
pi = 4.0 * count / num_samples
print(pi)