View percolator_opensearch_example.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
DELETE /percolator-queries | |
PUT percolator-queries | |
{ | |
"mappings": { | |
"properties": { | |
"search": { | |
"properties": { | |
"query": { | |
"type": "percolator" |
View example_window_function.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 base_data as ( | |
-- | |
select date_trunc('day', received_at) as received_at, count(*) as events_received | |
from some_com.performance_largest_contentful_paint where received_at > '2022-01-01' | |
group by date_trunc('day', received_at) order by date_trunc('day', received_at) | |
) | |
select received_at, events_received , | |
avg(events_received) over (partition by date_trunc('month',received_at)) as monthly_avg , |
View window_function_inside_case_statement.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
select *, | |
case | |
when confirmed_at is not null and price_dollars > 0 | |
then row_number() over ( | |
partition by user_id, price_dollars > 0 | |
order by confirmed_at | |
) | |
else null | |
end as user_enroll_rank, | |
case |
View gist:5fba9f7517114bdff6961bb0838aa963
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
select 'alter table ' || table_schema || '.' || table_name || ' alter column experiment_assignments type varchar(65535);' | |
from svv_columns | |
where table_schema = 'some' | |
and column_name = 'some' | |
and character_maximum_length = 512; |
View delete_honeycomb_columns_no_op_by_default.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
#!/usr/bin/env python3 | |
# usage: hny-column-cleanup.py [-h] -k API_KEY -d DATASET [-m {hidden,spammy}] | |
# Honeycomb Dataset Column Cleanup tool | |
# arguments: | |
# -h, --help show this help message and exit | |
# -k API_KEY, --api-key API_KEY | |
# Honeycomb API key | |
# -d DATASET, --dataset DATASET | |
# Honeycomb Dataset |
View 28_day_running_percentile.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 base_data as ( | |
select received_at, date_trunc('day', received_at)::date as end_date , | |
date_add('day', -28, date_trunc('day', received_at))::date start_date, load_time | |
from outschool_com.performance_largest_contentful_paint | |
where | |
received_at > date_add('day',-90, sysdate::date) | |
and load_time > 0 | |
and load_time < 60000 | |
--order by md5('seed' || received_at) | |
), |
View redshift_connector_playground.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
#!/bin/bash | |
set -e | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | |
source ${DIR}/../../scripts/utils.sh | |
if [ ! -f ${DIR}/RedshiftJDBC4-1.2.20.1043.jar ] | |
then |
View produce-kafka-rest-jsonschema.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
curl -X POST -H "Content-Type: application/vnd.kafka.jsonschema.v2+json" \ | |
-H "Accept: application/vnd.kafka.v2+json" \ | |
--data '{"value_schema_id":100101, "records": [{"value": {"name": "testUser", "planet":"moon"} } ] }' \ | |
"http://localhost:8082/topics/rest-proxy-test" |
View kafkacat_auth
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
kafkacat -F ./kafkacat.auth -p 0 -t postgres.public.activities -o 31992 -u -c1 | hexdump -C | |
sasl.username= | |
sasl.password= | |
sasl.mechanisms=PLAIN | |
# Required for correctness in Apache Kafka clients prior to 2.6 | |
#client.dns.lookup=use_all_dns_ips | |
# Best practice for Kafka producer to prevent data loss |
View kafkacat-consume-headers.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
kafkacat -F ./kafkacat.auth -p 0 -t dlq-lcc-dy0v1 -C -f '\nKey (%K bytes): %k | |
Value (%S bytes): %s | |
Timestamp: %T | |
Partition: %p | |
Offset: %o | |
Headers: %h\n' |
NewerOlder