Skip to content

Instantly share code, notes, and snippets.

View stanleyugwu's full-sized avatar
✌️

Stanley Ugwu stanleyugwu

✌️
View GitHub Profile
/**
* Partna v4 webhook handler. Follows Partna's best practices:
* 1. Verify the RSA-PSS signature before doing anything (reject spoofed events).
* 2. Acknowledge with 200 immediately — a slow handler triggers redelivery.
* 3. Process asynchronously and idempotently (a status change is applied at most once).
* 4. Log the raw payload for troubleshooting.
* See {@link verifyPartnaWebhookSignature} and {@link processPartnaWebhookEvent}.
*/
handlePartnaWebhook = async (req: Request<any, any, PartnaWebhookPayload>, res: Response) => {
const payload = (req.body ?? {}) as PartnaWebhookPayload;
@stanleyugwu
stanleyugwu / gist:56a6c675cb914ed8af4d845139f90ae3
Created June 1, 2026 12:57
All DEXes Perps (Commodities, Stocks, Index funds, etc)
{
"success": true,
"message": "Available assets fetched successfully",
"data": {
"allDexPerps": [
{
"universe": [
{
"szDecimals": 5,
"name": "BTC",
{
"success": true,
"message": "Available assets fetched successfully",
"data": {
"perps": [
{
"symbol": "BTC",
"type": "perp",
"markPx": "72680.0",
"maxLeverage": 40,
@stanleyugwu
stanleyugwu / tokenizer.js
Created November 23, 2025 20:35
Mini Tokenizer
let corpus = "the cat full overran the ran dog running do the needful";
corpus = corpus.replace(/ /g, "_");
let corpArr = corpus.split("");
const vocab = {};
const rules = [];
let id = 1;
const maxTokens = 50;
const sep = "<sep>";