Author: https://github.com/seanorama
Note: This was tested on HDP 3.1. It may not work with other Spark/YARN distributions.
javascript:(function(){try{navigator.clipboard.readText().then(function(t){if(t){var e=window.open("","_blank","width=800,height=600");e.document.open(),e.document.write(t),e.document.close()}else alert("Clipboard is empty. Please copy some text to the clipboard first.")}).catch(function(t){console.error("Failed to read clipboard contents: ",t),alert("An error occurred while trying to access the clipboard. Please ensure your browser allows clipboard access.")})}catch(t){console.error("An error occurred:",t),alert("An error occurred while trying to open the new window with the clipboard content.")}})();//bookmarklet_title: HTML Preview from Clipboard |
// Create a loading bar in your Google Sheet using Google Apps Script | |
// Author: Al Chen ([email protected]) | |
// Last Updated: April 13th, 2021 | |
// Notes: Assumes you are using the V8 runtime (https://developers.google.com/apps-script/guides/v8-runtime) | |
// Example Google Sheet: https://docs.google.com/spreadsheets/d/1ngvYKEMunqCVufR10rlK42iENAERp-uyiPN_aiq-MKo/edit?usp=sharing | |
SOURCE_SHEET_ID = 'YOUR_GOOGLE_SHEETS_ID' | |
SOURCE_WORKSHEET_NAME = 'YOUR_WORKSHEET_NAME' | |
function loop() { |
CREATE OR REPLACE PROCEDURE ledger.make_ledger_entries() BEGIN | |
DECLARE unique_item_names ARRAY<STRING>; | |
DECLARE item_idx INT64 DEFAULT 0; | |
DECLARE current_table_name STRING; | |
-- Create some fake staging data for illustration | |
-- In reality, this could be ingested from a federated data source | |
CREATE OR REPLACE TEMPORARY TABLE new_purchases AS ( | |
SELECT * |
SELECT day | |
FROM UNNEST( | |
GENERATE_DATE_ARRAY(DATE('2020-01-01'), DATE('2020-01-31'), INTERVAL 1 DAY) | |
) as day |
Author: https://github.com/seanorama
Note: This was tested on HDP 3.1. It may not work with other Spark/YARN distributions.
This is a sample script for retrieving values from a sheet filtered by Slicer in Spreadsheet using Google Apps Script.
By the update of Google side at November 6, 2019, Class Slicer was added. And also, for Sheets API, AddSlicerRequest and UpdateSlicerSpecRequest were added. By this, Slicer of Spreadsheet got to be able to be managed with Google Apps Script and other languages.
#standardSQL | |
#################################################################### | |
# PART 1: Cohort of New Users starting on SEPT 1 | |
#################################################################### | |
WITH | |
new_user_cohort AS ( | |
SELECT DISTINCT user_pseudo_id as new_user_id | |
FROM | |
`projectId.analytics_YOUR_TABLE.events_*` | |
WHERE |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'filters': { | |
}, | |
'formatters': { | |
'colored': { | |
'()': 'colorlog.ColoredFormatter', # colored output | |
# --> %(log_color)s is very important, that's what colors the line |
######################################## | |
## Title: Spark MLlib Linear Regression Script, with Cross-Validation and Parameter Sweep | |
## Language: PySpark | |
## Author: Colby T. Ford, Ph.D. | |
######################################## | |
from pyspark.ml.regression import LinearRegression | |
from pyspark.ml.tuning import ParamGridBuilder, CrossValidator | |
from pyspark.ml.evaluation import RegressionEvaluator |