This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.spark.graphx._ | |
| import org.apache.spark.rdd.RDD | |
| case class Peep(name: String, age: Int) | |
| val vertexArray = Array( | |
| (1L, Peep("Kim", 23)), | |
| (2L, Peep("Pat", 31)), | |
| (3L, Peep("Chris", 52)), | |
| (4L, Peep("Kelly", 39)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import nltk | |
| nltk.download() | |
| ## use nltk.download() within a Python prompt to | |
| ## download the `punkt` data | |
| ## Anaconda is recommended, to pick up NumPy, NLTK, etc. | |
| ## http://continuum.io/downloads | |
| ## this also requires TextBlob/PerceptronTagger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # using four part files to construct "minitweet" | |
| cat rawtweets/part-0000[1-3] > minitweets | |
| # change log4j properties to WARN to reduce noise during demo | |
| mv conf/log4j.properties.template conf/log4j.properties | |
| vim conf/log4j.properties # Change to WARN | |
| # launch Spark shell REPL | |
| ./bin/spark-shell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vagrant up | |
| vagrant ssh | |
| cd jem | |
| nbserver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // load error messages from a log into memory | |
| // then interactively search for various patterns | |
| // base RDD | |
| val lines = sc.textFile("log.txt") | |
| // transformed RDDs | |
| val errors = lines.filter(_.startsWith("ERROR")) | |
| val messages = errors.map(_.split("\t")).map(r => r(1)) | |
| messages.cache() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2014-03-04 | 15dfb8e6cc4111e3a5bb600308919594 | 11 | |
|---|---|---|---|
| 2014-03-06 | 81da510acc4111e387f3600308919594 | 61 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ./bin/spark-shell | |
| 14/04/18 15:23:49 INFO spark.HttpServer: Starting HTTP Server | |
| 14/04/18 15:23:49 INFO server.Server: jetty-7.x.y-SNAPSHOT | |
| 14/04/18 15:23:49 INFO server.AbstractConnector: Started [email protected]:49861 | |
| Welcome to | |
| ____ __ | |
| / __/__ ___ _____/ /__ | |
| _\ \/ _ \/ _ `/ __/ '_/ | |
| /___/ .__/\_,_/_/ /_/\_\ version 0.9.1 | |
| /_/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bash-3.2$ ssh -A -l ubuntu 54.205.7.177 | |
| The authenticity of host '54.205.7.177 (54.205.7.177)' can't be established. | |
| RSA key fingerprint is 60:0e:23:7a:b2:c7:42:50:82:86:57:8e:e3:a2:da:74. | |
| Are you sure you want to continue connecting (yes/no)? yes | |
| Warning: Permanently added '54.205.7.177' (RSA) to the list of known hosts. | |
| Welcome to Ubuntu 12.10 (GNU/Linux 3.5.0-41-generic x86_64) | |
| * Documentation: https://help.ubuntu.com/ | |
| System information as of Tue Dec 10 17:22:31 UTC 2013 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| paco@granite:~$ curl http://downloads.mesosphere.io.s3.amazonaws.com/chronos/chronos.tgz -o chronos.tgz | |
| % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 35.0M 100 35.0M 0 0 3800k 0 0:00:09 0:00:09 --:--:-- 6913k | |
| paco@granite:~$ tar xzf chronos.tgz | |
| paco@granite:~$ cd chronos/ | |
| paco@granite:~/chronos$ nohup ./bin/chronos-marathon & | |
| [1] 26210 | |
| paco@granite:~/chronos$ nohup: ignoring input and appending output to ‘nohup.out’ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print(__doc__) | |
| from time import time | |
| import numpy as np | |
| import pylab as pl | |
| from sklearn import metrics | |
| from sklearn.cluster import KMeans | |
| from sklearn.datasets import load_digits | |
| from sklearn.decomposition import PCA |