Skip to content

Instantly share code, notes, and snippets.

View etheleon's full-sized avatar
🎯
Focusing

etheleon etheleon

🎯
Focusing
View GitHub Profile
@etheleon
etheleon / neo4j.ipynb
Created May 24, 2019 03:46
neo4j/neo4j.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@etheleon
etheleon / Tricks.ipynb
Created May 14, 2019 03:40
github/DataCamp/Tricks.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
gcloud projects create <your>-dl --enable-cloud-apis
gcloud config set project <your>-dl
gcloud services enable compute.googleapis.com
gcloud iam service-accounts create gcp-terraform-dl --display-name gcp-terraform-dl
gcloud projects add-iam-policy-binding <your>-dl \
--member='serviceAccount:gcp-terraform-dl@ <your>-dl.iam.gserviceaccount.com' --role='roles/owner'
gcloud iam service-accounts keys create 'credentials.json' --iam-account='gcp-terraform-dl@<your>-dl.iam.gserviceaccount.com'
@etheleon
etheleon / Julia_adjacentproducts.ipynb
Created April 1, 2019 10:38
beedrive/Untitled8.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@etheleon
etheleon / Julia_adjacentproducts.ipynb
Created April 1, 2019 10:38
beedrive/Untitled8.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@etheleon
etheleon / julia_palindrome.ipynb
Last active March 30, 2019 11:28
beedrive/palindrome.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@etheleon
etheleon / stream.R
Created February 20, 2019 08:04
stream
data_stream <- sc %>% stream_read_json(s3_folder) %>%
filter(event=="Added to Cart") %>%
filter(properties.serviceType == 'Food') %>%
sdf_select(event,
cart_id = properties.CartId,
recommender = properties.experimentDetails.id,
variant = properties.experimentDetails.variant) %>%
filter(!is.na(recommender)) %>%
group_by(recommender) %>%
summarize(n = n()) %>%
@etheleon
etheleon / add_to_cart.r
Last active February 20, 2019 16:37
example_sparklyr_code_to_read_data_from_segment.r
add_to_cart_hourly <-
sc %>%
spark_read_json(
name = "atc_tbl",
path = "s3a://bucket/segment-logs/sourceId/day/*",
overwrite = TRUE
) %>%
filter(
event == "Added to Cart",
properties.serviceType == 'Food'
@etheleon
etheleon / connect_local_spark.R
Last active February 20, 2019 14:39
connecting to local spark with S3
conf <- spark_config()
conf$sparklyr.defaultPackages <- c("com.databricks:spark-csv_2.10:1.5.0",
"com.amazonaws:aws-java-sdk-pom:1.10.34",
"org.apache.hadoop:hadoop-aws:2.7.3")
conf$`sparklyr.shell.driver-memory.local` = "150G"
# Connect to Spark:
sc <- spark_connect(master = "local",
version = "2.4.0",
config = conf)