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
defmodule Nghenhan.MarketDataValidator do | |
@moduledoc """ | |
Validates market data completeness and quality by reading from the landing zone. | |
Runs as a separate service that can identify data quality issues without | |
affecting raw data collection. | |
""" | |
use GenServer | |
require Logger |
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
=ARRAYFORMULA( | |
SUM( | |
IF( | |
INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(),4), "1", "") & "2:" & SUBSTITUTE(ADDRESS(1,COLUMN(),4), "1", "") & COUNTA($A:$A)) = "x", | |
INDIRECT("$R2:$R" & COUNTA($A:$A)) / | |
INDIRECT("$Q2:$Q" & COUNTA($A:$A)), | |
0 | |
) | |
) | |
) |
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
defmodule Nghenhan.LandingZone do | |
@moduledoc """ | |
Hot Landing Zone implementation with fast recovery using segmented logs, | |
separate index files, and checkpoints. | |
""" | |
use GenServer | |
require Logger | |
@checkpoint_interval 300_000 # 5 minutes |
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
{ | |
"packages": [ | |
"rustup@latest", | |
"libiconv@latest", | |
"rustc-wasm32@latest", | |
"wasmtime@latest", | |
"cmake@latest" | |
], | |
"shell": { | |
"init_hook": [ |
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
defmodule ExactlyOnce do | |
use GenServer | |
require Logger | |
# State will store processed event IDs and their status | |
defmodule State do | |
defstruct processed_events: %{}, | |
processing_timeouts: %{}, | |
retry_interval: 5_000, | |
processing_timeout: 30_000 |
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
function createDataType<T extends { type: string }>() { | |
return new Proxy( | |
{}, | |
{ | |
get(_, type: string) { | |
return (data = {}) => ({ type, ...data }); | |
}, | |
} | |
) as { | |
[K in T['type']]: ( |
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
defmodule DiscordCollector.FLAMEDecorator do | |
@moduledoc """ | |
Provides FLAME function decorators that wrap functions to run in FLAME pools. | |
## Usage | |
defmodule MyModule do | |
use DiscordCollector.FLAMEDecorator | |
@decorate flame(MyApp.Pool) |
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
-- Create the deposit_interest_rates table | |
CREATE TABLE deposit_interest_rates ( | |
id UUID PRIMARY KEY, | |
bank_id UUID NOT NULL, | |
term INTEGER NOT NULL, | |
interest_rate DECIMAL(5,2) NOT NULL, | |
inserted_at TIMESTAMP WITHOUT TIME ZONE NOT NULL, | |
updated_at TIMESTAMP WITHOUT TIME ZONE NOT NULL | |
); |
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
import { asapScheduler, Observable, ObservableInput, SchedulerLike, Subject } from 'rxjs'; | |
import { bufferTime, first, map, mergeMap, share } from 'rxjs/operators'; | |
export type BatchLoadFn<K = any, V = any> = (keys: K[]) => ObservableInput<V>; | |
export type Options = { | |
bufferTimeSpan?: number | |
bufferCreationInterval?: number | null | |
maxBufferSize?: number | |
scheduler?: SchedulerLike | |
} |
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
import { Fragment, FunctionComponent, ReactNode, createElement, useEffect, useState } from "react"; | |
import { asyncScheduler, BehaviorSubject, combineLatest, Observable } from "rxjs"; | |
import { debounceTime, distinctUntilChanged, map, startWith } from "rxjs/operators"; | |
type ObservableMap<T> = Map<Observable<T>, number>; | |
type ProxyHandlerType<K extends string | symbol, V> = { get(target: V, prop: K): V }; | |
interface ProxyInterface { | |
$: <T>(obs: Observable<T>) => T; | |
} |