Skip to content

Instantly share code, notes, and snippets.

Technical Interview Question: Counting Squares from Points

Prompt

You are given a vector of points in 2D space, represented as Vec<(i32, i32)>. Write a function that returns the number of distinct squares that can be formed using these points as vertices.

A square is defined as a quadrilateral with four equal sides and four right angles.


import { CrossbarClient, OracleJob } from "@switchboard-xyz/common";
/**
* Creates an Oracle Job definition for hyloUSD
* HyloTask converts 1 hyUSD to jitoSOL
* hyUSD is a stablecoin with NAV pegged to $1.00 USD
* @returns OracleJob configured to fetch hyUSD to jitoSOL conversion rate
*/
function getHyloUSDJob(): OracleJob {
const job = OracleJob.fromObject({
import { OracleQuote } from './src/classes/oracleQuote.js';
// Your hex string
const hexData = '0100100000005000000070005100000047c0a7750a1809cab7d20a63c56f4c337d4d3cbef811abc27c2d0733c9698664d0dc7526e113052843ca295575fda8375bb8c013e1e8f8522cd96acd94f8280a887d70946cbfbd9ff02d81dff0a80f74c8f6c1fc7c456fbde36784ebec8020fb5e5340cd96123980828ce60bb40ad16d805ec03b003fec50a6922a014e495a0136a820f6fe617053e0b9886e39b583fc5d904553964623d02d3e924c07670f300000e2c7cea8990d0000000000000000010a6cf36b16000000000053424f44';
// Convert hex to Buffer
const buffer = Buffer.from(hexData, 'hex');
try {
// Decode the instruction data
import { wrap as wrapFetch } from "@faremeter/fetch";
import { Keypair, PublicKey, Connection } from "@solana/web3.js";
import { createLocalWallet } from "@faremeter/wallet-solana";
import { exact } from "@faremeter/payment-solana";
import * as fs from "fs";
(async function main() {
const keypair = Keypair.fromSecretKey(
Uint8Array.from(JSON.parse(fs.readFileSync(process.env.SOL_KEY_PATH!, "utf-8"))),
);
import { wrap as wrapFetch } from "@faremeter/fetch";
import { Keypair, PublicKey, Connection } from "@solana/web3.js";
import { createLocalWallet } from "@faremeter/wallet-solana";
import { createPaymentHandler } from "@faremeter/x-solana-settlement";
import * as fs from "fs";
(async function main() {
const keypair = Keypair.fromSecretKey(
Uint8Array.from(JSON.parse(fs.readFileSync(process.env.SOL_KEY_PATH!, "utf-8"))),

Subscriber Program Design Document

Overview

The Subscriber program manages subscription tiers for Switchboard oracle data access. Users burn payment tokens (SWTCH or other configured tokens) to subscribe to different service levels that control data delivery latency, rate limits, and streaming capacity. Each accepted payment token has a configurable multiplier that affects subscription duration.

Program ID

// TBD - Will be generated during deployment
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
pub struct SwitchboardQuote {
/// Queue pubkey that this oracle quote belongs to
pub queue: [u8; 32],
/// Uses 2-byte (u16) length prefix
pub signatures: SmallVec<OracleSignature, U16Prefix>,
/// Quote header containing the signed slot hash
pub quote_header: PackedQuoteHeader,
/// Array of feed information (max 255)
/// Uses 1-byte (u8) length prefix
-- Function to Get System Info
on get_system_info()
set timestamp to do shell script "date '+%m/%d/%Y %I:%M:%S %p'"
set computerName to do shell script "scutil --get ComputerName"
set currentUser to do shell script "whoami"
return timestamp & " - Computer: " & computerName & " | User: " & currentUser
end get_system_info
-- Function to Send Message (now sends to your custom webhook instead of Telegram directly)
#!/usr/bin/env bun
import { CrossbarClient } from "@switchboard-xyz/common";
import * as fs from 'fs';
import * as crypto from 'crypto';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
interface Arguments {
apiKeyId: string;
@mgild
mgild / devrel.md
Last active October 5, 2025 14:55

Switchboard DevRel Take-Home (Solana)

Assignment 1 — Docs Review (Switchboard)

Review docs.switchboard.xyz and the Switchboard Examples repository.

Prompt

  • Which sections lack clarity, feel incomplete, or are out of order?
  • Propose 3 concrete improvements (titles, placement, code, diagrams, examples).
  • For each, explain why it helps adoption and where it should live in the nav.