View window_function_comparison.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View spark_s3a_instructions.sh
This file contains 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
# For a local environment | |
# Install hadoop and apache-spark via homebrew | |
# Apache Spark conf file | |
# libexec/conf/spark-defaults.conf | |
# Make the AWS jars available to Spark | |
spark.executor.extraClassPath /usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/aws-java-sdk-1.7.4.jar:/usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/hadoop-aws-2.7.1.jar | |
spark.driver.extraClassPath /usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/aws-java-sdk-1.7.4.jar:/usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/hadoop-aws-2.7.1.jar | |
# Add file |
View big_query_costs_by_user.sql
This file contains 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
/* | |
# https://cloud.google.com/bigquery/audit-logs#sample_audit_queries_in_bigquery | |
select | |
protopayload_auditlog.authenticationInfo.principalEmail as user_email, | |
protopayload_auditlog.servicedata_v1_bigquery.jobCompletedEvent.job.jobConfiguration.query.query, | |
-- protopayload_auditlog.servicedata_v1_bigquery.jobCompletedEvent.job.jobStatus.state, | |
-- protopayload_auditlog.servicedata_v1_bigquery.jobCompletedEvent.job.jobStatus.error.code, | |
-- protopayload_auditlog.servicedata_v1_bigquery.jobCompletedEvent.job.jobStatus.error.message, | |
sum(protopayload_auditlog.servicedata_v1_bigquery.jobCompletedEvent.job.jobStatistics.totalBilledBytes) billedBytes, |
View price_elasticity.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View bq_sales_yoy.sql
This file contains 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
-- | |
-- Week Daily for non-Orthogonal Date dimensions e.g. day of week | |
-- | |
with Calendar as ( | |
select | |
this_year, | |
date_add(this_year, interval - 364 day) as last_year | |
from | |
unnest(GENERATE_DATE_ARRAY('2017-01-01', '2017-12-31')) as this_year | |
), |
View fun_with_time.bash
This file contains 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
#!/usr/bin/env bash | |
DATASET="<YOUR DATASET HERE>" | |
TABLE="fun_with_time" | |
SCHEMA_FILE="/tmp/ts-schema.json" | |
DATA_FILE="/tmp/ts-data.ndjson" | |
SQL_FILE="/tmp/query.sql" | |
BUCKET="<YOUR BUCKET HERE>" | |
cat <<EOM >${SCHEMA_FILE} |
View gigaclear_scrape.py
This file contains 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
""" | |
Script to scrape Gigaclear status for each postcode (in this case in GL* areas) | |
Writes a Json file with lat-lon, postcode and response for display and | |
later reference | |
""" | |
import requests | |
import csv | |
import io | |
import time |
View gigaclear_map.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gigaclear.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gbq_unnest.sql
This file contains 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
with X as ( | |
-- select STRUCT<x int64, y string>(1, 'a') as R | |
select * | |
-- from unnest(split("I am the bad man, I am the bad man", " ")) as w with offset as c | |
from | |
unnest([ | |
-- Will be named and explictly typed | |
-- STRUCT<x int64, y string>(1, 'a'), | |
-- STRUCT<x int64, y string>(2, 'b'), | |
-- STRUCT<x int64, y string>(3, 'c') |
NewerOlder