This file contains hidden or 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
| # frozen_string_literal: true | |
| require 'benchmark/ips' | |
| require 'redis' | |
| $redis = Redis.new | |
| class MethodProfiler | |
| def self.patch_using_alias_method(klass, methods, name) | |
| patch_source_line = __LINE__ + 3 |
This file contains hidden or 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
| services: | |
| ch_server: | |
| image: clickhouse/clickhouse-server:latest | |
| ports: | |
| - "8123:8123" | |
| - "9000:9000" | |
| volumes: | |
| - ch_data:/var/lib/clickhouse | |
| - type: bind | |
| source: ./settings/users.xml |
This file contains hidden or 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
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'benchmark-ips' | |
| gem 'red-arrow' | |
| end | |
| require 'arrow' |
This file contains hidden or 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
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'curb' | |
| gem 'benchmark-ips' | |
| gem 'oj' | |
| gem 'red-parquet' | |
| gem 'rover-df' |
This file contains hidden or 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
| ENGINE = ReplicatedSummingMergeTree | |
| PARTITION BY toYYYYMMDD(date) | |
| PRIMARY KEY app_id, date, install_date | |
| SELECT install_date, SUM(install_count) | |
| FROM analytics_grouped_stats_shard | |
| PREWHERE (attribution_network IN ('Facebook Ads')) AND (date >= toDate('2021-08-01')) AND (date < today()) | |
| AND (install_date >= toDate('2021-08-01')) AND (install_date <= toDate('2021-08-31')) | |
| GROUP BY install_date |
This file contains hidden or 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 count(1) from dummy_buf => 0 | |
| kafkacat -b kafka_brokers -t dummy -P | |
| {"ad_type":1} | |
| select count(1) from dummy_buf => 1 | |
| ... | |
| select count(1) from dummy_buf => 200 |
This file contains hidden or 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
| 2019.08.01 13:38:43.908010 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Subscribed to topics: dashboard_stats | |
| 2019.08.01 13:38:43.908041 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Assigned to topics: dashboard_stats dashboard_stats dashboard_stats dashboard_stats dashboard_stats dashboard_stats dashboard_stats dashboard_stats | |
| 2019.08.01 13:38:44.190842 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Polled batch of 65536 messages | |
| 2019.08.01 13:38:44.367789 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Polled batch of 65536 messages | |
| 2019.08.01 13:38:44.530755 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Polled batch of 65536 messages | |
| 2019.08.01 13:38:44.745517 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Polled batch of 65536 messages | |
| 2019.08.01 13:38:45.043154 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Polled batch of 65536 messages | |
| 2019.08.01 13:38:45.652610 [ 37 ] {} <Trace> StorageKafka (dashboard_stats_queue): Polled batch of 655 |
This file contains hidden or 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
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'activerecord', '4.2.4' |
This file contains hidden or 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
| require 'bigdecimal' | |
| require 'benchmark' | |
| class DiceSumProbabilityCalc | |
| DEFAULT_SIDES_COUNT = 6 | |
| def initialize(sum, dices_count, dice_sides_count = DEFAULT_SIDES_COUNT) | |
| @sum = sum | |
| @dices_count = dices_count | |
| @dice_sides_count = dice_sides_count |
This file contains hidden or 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
| def accounts | |
| Account.arel_table | |
| end | |
| def subscriptions | |
| Subscription.arel_table | |
| end | |
| def charges | |
| Charge::Base.arel_table |