https://www.cloudskillsboost.google/focuses/1740?locale=ja&parent=catalog
export PW="Password1*"| # make Rel in Hasse diagram | |
| # 0 and 1 are trivial and omitted | |
| require 'prime' | |
| Graph = Data.define(:nodes, :edges) do | |
| def initialize(nodes: [], edges: []) | |
| super | |
| end | |
| end | 
| def naive(n) | |
| s = ?A | |
| (n-1).times { s.succ! } | |
| s | |
| end | |
| def digits(n, base=10) | |
| ds = [] | |
| while n > 0 | |
| case n.divmod(base) | 
| Copyright (c) <year> <copyright holders> | |
| This software is provided ‘as-is’, without any express or implied | |
| warranty. In no event will the authors be held liable for any damages | |
| arising from the use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it | |
| freely, subject to the following restrictions: | 
| mkdir -p d/x | |
| find d -regextype posix-extended -regex 'd(/x){1,29}' -exec mkdir -p '{}'/x \; | |
| find d -regextype posix-extended \ | |
| -regex 'd((/x){3})+' -printf "Fizz" , \ | |
| -regex 'd((/x){5})+' -printf "Buzz" , \ | |
| -regex 'd((/x){3})+' -o \ | |
| -regex 'd((/x){5})+' -o \ | |
| -regex 'd(/x)+' -printf "%d" , \ | 
| SELECT sum(cumulative_confirmed) as total_cases_worldwide | |
| FROM `bigquery-public-data.covid19_open_data.covid19_open_data` | |
| WHERE date=? | |
| ; | |
| WITH | |
| deaths_by_states AS ( | |
| SELECT | |
| subregion1_name AS state, | |
| SUM(cumulative_deceased) AS death_count | 
| CREATE OR REPLACE MODEL `ecommerce.customer_classification_model` | |
| OPTIONS | |
| ( | |
| model_type='logistic_reg', | |
| labels = ['will_buy_on_return_visit'] | |
| ) | |
| AS | |
| #standardSQL | |
| SELECT | |
| * EXCEPT(fullVisitorId) | 
https://www.cloudskillsboost.google/focuses/1740?locale=ja&parent=catalog
export PW="Password1*"| CREATE OR REPLACE VIEW bq_logs.v_querylogs AS | |
| WITH job_completed_event AS ( | |
| SELECT | |
| resource.labels.project_id, | |
| protopayload_auditlog.authenticationInfo.principalEmail, | |
| protopayload_auditlog.servicedata_v1_bigquery.jobCompletedEvent.job AS job, | |
| severity | |
| FROM `bq_logs.cloudaudit_googleapis_com_data_access_*` | |
| ) | |
| SELECT | 
| SELECT dt, | |
| DATETIME_DIFF(DATETIME(dt), FIRST_VALUE(DATETIME(dt)) OVER (w), SECOND) / | |
| DATETIME_DIFF(LAST_VALUE(DATETIME(dt)) OVER (wall), FIRST_VALUE(DATETIME(dt)) OVER (w), SECOND) AS progress | |
| FROM UNNEST(GENERATE_DATE_ARRAY('2024-01-01', '2025-01-01')) AS dt | |
| QUALIFY progress < 1 | |
| WINDOW w AS ( ORDER BY dt ), | |
| wall AS ( ORDER BY dt ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) | |
| ; | |
| SELECT t, | 
| ruby -r'uri' -lpe 'uri=URI.parse($_);(uri.query||uri.path).gsub!(/\.$/,"%2E");$_=uri.to_s' |