Skip to content

Instantly share code, notes, and snippets.

View adetokunbo's full-sized avatar

Timothy Emiola adetokunbo

  • Itoshima, Japan
View GitHub Profile
@adetokunbo
adetokunbo / explain-compute-reward-totals-restructured-2026-03-26.txt
Created March 26, 2026 05:35
EXPLAIN ANALYZE — computeRewardTotals restructured (no second CTE pass)
EXPLAIN ANALYZE — computeRewardTotals restructured (no second pass through computed CTE)
Date: 2026-03-26
Setup: 10000 activity records, 100 distinct parties, round=42
Query: thresholded = totalIssuance - unclaimed - mintingAllowance (inline arithmetic)
================================================================================
EXPLAIN ANALYZE — computeRewardTotals restructured (round=42, historyId=1)
================================================================================
Insert on app_reward_round_totals (cost=8.22..8.24 rows=0 width=0) (actual time=0.266..0.267 rows=0 loops=1)
CTE inserted_parties
@adetokunbo
adetokunbo / explain-compute-reward-totals-combined-2026-03-25.txt
Created March 25, 2026 11:34
EXPLAIN ANALYZE — computeRewardTotals (combined CTE with RETURNING)
EXPLAIN ANALYZE — combined computeRewardTotals CTE
Date: 2026-03-25
Setup: 10000 activity records, 100 distinct parties, round=42
================================================================================
EXPLAIN ANALYZE — combined computeRewardTotals (round=42, historyId=1)
================================================================================
Insert on app_reward_round_totals (cost=8.27..8.29 rows=0 width=0) (actual time=0.218..0.219 rows=0 loops=1)
CTE computed
-> Index Scan using uq_app_activity_party on app_activity_party_totals (cost=0.15..8.18 rows=1 width=52) (actual time=0.012..0.034 rows=100 loops=1)
@adetokunbo
adetokunbo / explain-compute-reward-totals-2026-03-25.txt
Created March 25, 2026 11:34
EXPLAIN ANALYZE — computeRewardTotals (separate queries)
EXPLAIN ANALYZE — computeRewardTotals queries
Date: 2026-03-25
Setup: 10000 activity records, 100 distinct parties, round=42
================================================================================
EXPLAIN ANALYZE — insertPartyRewards (round=42, historyId=1)
================================================================================
Insert on app_reward_party_totals (cost=0.15..8.20 rows=0 width=0) (actual time=0.057..0.057 rows=0 loops=1)
-> Index Scan using uq_app_activity_party on app_activity_party_totals (cost=0.15..8.20 rows=1 width=50) (actual time=0.056..0.056 rows=0 loops=1)
Index Cond: ((history_id = '1'::bigint) AND (round_number = '42'::bigint))
#!/bin/bash
# Options / Usage
# put this script in the same directory as your *.cabal file
# it will use the first line of "cabal info ." to determine the package name
# custom options for "cabal install"
CUSTOM_OPTIONS=(--haddock-options='-q aliased')
# hackage server to upload to (and to search uploaded versions for)
HACKAGESERVER=hackage.haskell.org
@adetokunbo
adetokunbo / test.hs
Created February 20, 2023 08:02 — forked from anonymous/test.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
import Control.Applicative ((<$>))
{
"AD": {
"countryName": "Andorra",
"currency": "EUR",
"symbol": "€"
},
"AE": {
"countryName": "United Arab Emirates",
"currency": "AED",
"symbol": "AED"
@adetokunbo
adetokunbo / gist:e00f2c0c6f6e07be7a26069c7cfe4578
Created January 13, 2022 02:09
haskell.nix: wai-middleware-delegate: cabal build fails after successful nix-shell when upgrading to text-2.0
$ nix-shell
building '/nix/store/2p075yxfnykj1wgcf7cl83n3ygnnlds1-git-ls-files.drv'...
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-01-06T00:00:00Z)!
trace: To make project.plan-nix for hoogle a fixed-output derivation but not materialized, set `plan-sha256` to the output of the 'calculateMaterializedSha' script in 'passthru'.
trace: To materialize project.plan-nix for hoogle entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.
trace: No index state specified for cabal-install, using the latest index state that we know about (2022-01-06T00:00:00Z)!
trace: No index state specified for ghcid, using the latest index state that we know about (2022-01-06T00:00:00Z)!
trace: No index state specified for haskell-language-server, using the latest index state that we know about (2022-01-06T00:00:00Z)!
trace: No index state specified for hlint, using the latest index state that we know about (202
@adetokunbo
adetokunbo / setup-ubuntu-wp.sh
Created December 3, 2021 19:36 — forked from tjstein/setup-ubuntu-wp.sh
WordPress auto-setup for Ubuntu (ve)
#!/bin/bash
cd
#
# fix locales
#
echo "en_US.UTF-8 UTF-8" > /var/lib/locales/supported.d/local
dpkg-reconfigure locales
@adetokunbo
adetokunbo / haskell.yml
Created September 30, 2021 08:16 — forked from mstksg/haskell.yml
Stack Project Github Action Template
# Haskell stack project Github Actions template
# https://gist.github.com/mstksg/11f753d891cee5980326a8ea8c865233
#
# To use, mainly change the list in 'plans' and modify 'include' for
# any OS package manager deps.
#
# Currently not working for cabal-install >= 3
#
# Based on https://raw.githubusercontent.com/commercialhaskell/stack/stable/doc/travis-complex.yml
#
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module HFilter where
data a :* b = a :* b
deriving (Show, Eq)
infixr 5 :*
hlist :: Int :* String :* Int :* Maybe Float :* ()