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/bash | |
set -e | |
########################################################## | |
# Install script for Docker-CE on ElementaryOS 0.4.1 Loki | |
# Had to update the repository to point to xenial instead | |
# of using 'lsb_release -cs' because there's no loki | |
# repository at download.docker.com. | |
########################################################## |
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
This gist includes hive ql scripts to create an external partitioned table for Syslog | |
generated log files using regex serde; | |
Usecase: Count the number of occurances of processes that got logged, by year, month, | |
day and process. | |
Includes: | |
--------- | |
Sample data and structure: 01-SampleDataAndStructure | |
Data download: 02-DataDownload | |
Data load commands: 03-DataLoadCommands |
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
package com.databricks.spark.jira | |
import scala.io.Source | |
import org.apache.spark.rdd.RDD | |
import org.apache.spark.sql._ | |
import org.apache.spark.sql.functions._ | |
import org.apache.spark.sql.sources.{TableScan, BaseRelation, RelationProvider} |
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
val transactions = spark.read | |
.option("header", "true") | |
.option("inferSchema", "true") | |
.json("s3n://bucket-name/transaction.json") | |
transactions.groupBy("id", "organization").count.sort($"count".desc).show |
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
val today = LocalDate.now | |
val todayTransactions = spark.read | |
.option("header", "true") | |
.option("inferSchema", "true") | |
.json(s"s3n://bucket-name/${today}/transaction.json") | |
val yesterdayTransactions = spark.read | |
.option("header", "true") | |
.option("inferSchema", "true") |
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
curl -X POST -d http://master-host:6066/v1/submissions/create --header "Content-Type:application/json" --data '{ | |
"action": "CreateSubmissionRequest", | |
"appResource": "hdfs://localhost:9000/user/spark-examples_2.11-2.0.0.jar", | |
"clientSparkVersion": "2.0.0", | |
"appArgs": [ "10" ], | |
"environmentVariables" : { | |
"SPARK_ENV_LOADED" : "1" | |
}, | |
"mainClass": "org.apache.spark.examples.SparkPi", | |
"sparkProperties": { |
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
package main | |
import ( | |
"database/sql" | |
"fmt" | |
_ "github.com/mattn/go-sqlite3" | |
) | |
func main() { |
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
func main() { | |
aliceAcct := OpenSavingsAccount("12345", "Alice", time.Date(1999, time.January, 03, 0, 0, 0, 0, time.UTC)) | |
fmt.Println("Alice's account =", aliceAcct) | |
aliceAcct.Deposit(Money(100.0)) | |
fmt.Println("Alice's account (after deposit) =", aliceAcct) | |
if err := aliceAcct.Withdraw(Money(10)); err != nil { | |
fmt.Println(err) | |
} else { |
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
package account | |
import ( | |
"errors" | |
"fmt" | |
"time" | |
) | |
//Account is an interface that wraps the common behavior for accounts. | |
type Account interface { |