Skip to content

Instantly share code, notes, and snippets.

@chaityacshah
chaityacshah / Spark aggregateByKey
Created October 23, 2019 18:58 — forked from tmcgrath/Spark aggregateByKey
Spark aggregateByKey example
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 1.1.0
/_/
Using Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65)
Type in expressions to have them evaluated.
Type :help for more information.
GlowScript 2.9 VPython
# https://www.wired.com/story/plant-a-tree-for-climate-change/?mod=djemTECH
na=6.022e23
#diameter of tree
d=1.5 #m
#height of tree
h=15 #
#density of tree
rho=500 #kg/m^3
@chaityacshah
chaityacshah / multiple_ssh_setting.md
Created September 18, 2019 03:13 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@chaityacshah
chaityacshah / custom.css
Created August 25, 2018 02:33 — forked from ChrisBeaumont/custom.css
Demystifying Python Descriptors
<style>
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');
}
div.cell{
width:800px;
margin-left:16% !important;
margin-right:auto;
}
@chaityacshah
chaityacshah / test_cases.md
Last active July 21, 2018 22:38
test cases for stackoverflow question

1

pprint.pprint(parse("(dog:20, (elephant:30, horse:60)eh:20)root:50"))

2

pprint.pprint(parse("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5,G:0.8)F:0.9"))

3

pprint.pprint(parse("(ant:17, (bat:31, cow:22)bc:7, dog:22, (elk:33, fox:12)ef:40)root:1"))

4

pprint.pprint(parse("(Bovine:0.69395,(Gibbon:0.36079,(Orang:0.33636,(Gorilla:0.17147,(Chimp:0.19268, Human:0.11927)ch:0.08386)gch:0.06124)ggch:0.15057)oggch:0.54939,Mouse:1.21460)root:1"))

factual.com

returns basic business info like name, location, etc.
disadv: only textual data. no restaurant logos

  • Search for restaurants by name, cuisine, or location
  • Display detailed information including ratings, location and cuisine
  • Use the Zomato Foodie Index to show great areas to dine in a city

Get/search returns URL of menu too.

1. Number of times pregnant 2. Plasma glucose concentration a 2 hours in an oral glucose tolerance test 3. Diastolic blood pressure (mm Hg) 4. Triceps skin fold thickness (mm) 5. 2-Hour serum insulin (mu U/ml) 6. Body mass index (weight in kg/(height in m)^2) 7. Diabetes pedigree function 8. Age (years) 9. Class variable (0 or 1)
6 148 72 35 0 33.6 0.627 50 1
1 85 66 29 0 26.6 0.351 31 0
8 183 64 0 0 23.3 0.672 32 1
1 89 66 23 94 28.1 0.167 21 0
0 137 40 35 168 43.1 2.288 33 1
5 116 74 0 0 25.6 0.201 30 0
3 78 50 32 88 31.0 0.248 26 1
10 115 0 0 0 35.3 0.134 29 0
2 197 70 45 543 30.5 0.158 53 1
from scipy.cluster.hierarchy import dendrogram, linkage
import sys
import matplotlib
matplotlib.use("Qt5Agg")
import numpy as np
from numpy import arange, sin, pi
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib import pyplot as plt