Histogram Quantile Buckets
Record observations into cumulative histogram buckets and interpolate a quantile within the crossing bucket.
Page 41 of 50
Record observations into cumulative histogram buckets and interpolate a quantile within the crossing bucket.
Simulate multi-version concurrency control so a transaction reads a consistent snapshot while others commit new versions.
Implement optimistic locking with a version column, returning a typed conflict result when concurrent writers collide.
Generate random inputs for a property test and shrink a failing case to a minimal counterexample.
Parse short options and their arguments with getopts so a shell script exposes a predictable CLI instead of positional guesswork.
Aggregate CSV columns with awk: per-group sums, counts, and computed ratios in one pass over streaming input.
Structure script output with a logger function: level filtering, stderr separation, timestamps, and color-aware terminals.
Turn a header CSV into newline-delimited JSON by streaming rows through awk and jq, preserving the header as field names.
Retry curl against flaky endpoints with retry flags, exponential backoff, and server-side Retry-After header respect.
Script a full container release flow: build with cache pins, tag by digest and git SHA, push, and wait for registry health.
Validate required environment variables upfront with parameter expansion guards, checking formats before any side effects.
Scan a directory tree, sort files by size, and print the largest offenders so disk pressure can be investigated quickly.
Prevent concurrent script runs with flock on a lockfile, distinguishing owner from contenders and timing out politely.
Parse long and short options robustly with getopt, validating required flags, defaults, and positional arguments.
Enforce quality gates with a pre-commit hook running lint and format checks, mirrored by the CI pipeline stages.
Transform JSON on the command line with jq filters, selecting fields, reshaping objects, and aggregating arrays in pipes.
Retry a shell command that may fail transiently, waiting longer between attempts and reporting the last error when all tries are exhausted.
Poll rate-limited APIs politely with sleep pacing, exponential spacing for empty results, and a hard attempt ceiling.
Start scripts with strict mode settings so unset variables, failing commands, and pipe errors stop execution instead of being silently ignored.
Harden shell scripts with set -euo pipefail and an ERR trap, converting silent failures into loud, traceable exits.
Emit log lines with a UTC timestamp, level, and message from one helper, so shell output stays consistent and easy to parse.
Stream growing log files with tail -F and grep pipelines, highlighting patterns and stopping cleanly on signals.
Bound external commands with the timeout utility, distinguishing exit code 124 from genuine failures and retrying on it.
Guarantee resource cleanup on any exit path with traps for EXIT INT TERM, keeping partial work dirs off the filesystem.
Register a trap so temporary files and processes are cleaned up even when the script fails or is interrupted.
Poll a health endpoint until a dependency is ready or a timeout elapses, preventing a start-up script from racing ahead of its services.
Process file batches in parallel with xargs -P and -N, controlling concurrency, preserving order, and capping memory.
Track hot counters with atomic operations instead of mutexes, exporting per-second rates and cumulative values for monitoring.
Parse newline-delimited JSON streams with bufio.Scanner, sizing buffers for long lines and isolating malformed records.
Log every request with chi middleware: request ids, durations, status codes, and route patterns instead of raw paths.
Trip a circuit breaker after consecutive failures, short-circuiting calls during an open period and probing recovery with a half-open state.
Resolve CLI configuration with explicit precedence from flags over environment over config file, with typed defaults and validation.
Derive a context with a deadline so downstream work is cancelled when the caller gives up, and propagate the reason through context errors.
Give outbound HTTP calls hard deadlines with context timeouts, propagating cancellation into DNS, connect, and body read phases.
Query and control Docker containers with the Go SDK, filtering by labels, streaming events, and reporting runtime stats.
Read configuration from environment variables with typed parsing and defaults, validating required fields at startup rather than at first use.
Run parallel HTTP fetches under one errgroup context so the first error cancels siblings and always reclaims goroutines.
Fan out calls to many shards with errgroup SetLimit bounding concurrency, merging partial results even when some shards fail.
Fetch several resources concurrently with errgroup so the first error cancels the rest and the combined call fails fast.
Throttle Fiber routes with a sliding-window rate limiter middleware, keying by API key with burst tolerance and custom 429 bodies.
Write generic min and max helpers constrained to ordered types, avoiding duplication across numeric and string collections.
Extract and verify JWT claims in Gin middleware, checking issuer and role before handlers, with claims injected into context.
Build a Go CI pipeline with matrix versions, module caching, lint gates, race-enabled tests, and release artifact uploads.
Batch independent Redis commands into pipelines and transactions, measuring round-trip savings and verifying atomic MULTI execution.
Configure the go-redis universal client for single, sentinel, and cluster topologies, with pool sizing and timeout discipline.
Run a hub that registers WebSocket clients into rooms, broadcasts messages to a room, and unregisters on disconnect or expiry.
Paginate PostgreSQL result sets with GORM using keyset conditions on indexed sort columns, stable under concurrent inserts.
Implement Relay-style cursor pagination with gqlgen resolvers, resolving edges and pageInfo from a keyset-ordered store.
Stop an HTTP server gracefully on SIGTERM, draining connections with a bounded context deadline before forcing closure.
Listen for termination signals and shut an HTTP server down gracefully so in-flight requests finish before the process exits.
Set per-call deadlines on gRPC clients, propagate cancellation through context, and classify DEADLINE_EXCEEDED versus CANCELED codes.
Decode a stream of JSON values from a reader without buffering the whole payload, using a decoder that reads records one at a time.
Compose HTTP handlers through middleware that wrap the next handler, adding logging, recovery, and request identifiers without duplication.
Tail MongoDB collection changes with the Go driver, filtering server-side, resuming by token, and timing out idle watches.
Stream multipart uploads in a Go handler with a memory threshold, per-file size caps, and non-blocking cleanup of partial files.
Harden an HTTP server with read, write, idle, and header timeouts so slow or hostile clients cannot pin connections open.
Drive PostgreSQL through a pgx connection pool with statement timeouts, health pings, and context-scoped transactions.
Detect PostgreSQL serialization failures in pgx transactions and retry the whole unit with backoff, aborting only on hard errors.
Expose Go runtime profiling endpoints on an internal port, sampling CPU flame graphs, heap snapshots, and goroutine dumps.
Implement a token bucket rate limiter that refills at a configured rate and allows a burst, guarding handlers against traffic spikes.
Retry idempotent HTTP requests on server errors and throttling responses, backing off between attempts and honouring context cancellation.
Retry transient failures with capped exponential backoff plus jitter, classifying errors by retryability and giving up with context.
Shield a slow loader with singleflight and a shared cache, collapsing concurrent misses into one fetch and serving stale during refresh.
Collapse duplicate concurrent requests for the same key into a single upstream call so a burst of callers does not stampede a slow dependency.
Adopt Go structured logging with slog: leveled JSON handlers, grouped attributes, log record routing, and child loggers with bound context.
Wrap failing dependencies with sony/gobreaker, opening the circuit after consecutive failures and probing recovery in half-open.
Run a parameterised query and scan each row into a struct, closing rows and checking the iteration error so resources are not leaked.
Guard outbound fetches against SSRF with an allowlist of hosts and schemes, blocking private networks and redirects to internal IPs.
Emit structured logs with the standard slog package so records carry typed key-value attributes that are easy to filter and correlate.
Recycle byte buffers with sync.Pool to cut allocation churn in hot paths, using Get/Put discipline and clearing on store.
Structure Go tests as a table of cases with subtests, so each scenario is named, isolated, and easy to extend with new rows.
Cover function branches with table-driven tests: declarative cases with names, parallel subtests, and precise failure output.
Implement a concurrency-safe token bucket with atomic refill math, per-key buckets, and TryTake plus blocking Take semantics.
Layer application config with Viper across files, environment variables with key replacer, and overrides bound to flags.
Keep WebSocket connections alive with application-level ping frames, tracking liveness with deadlines and cleaning dead peers.
Process a job channel with a fixed pool of workers, draining remaining jobs on shutdown and collecting per-worker stats safely.
Dispatch jobs to a fixed pool of workers through channels, bounding concurrency while processing a large queue of tasks.
Validate request bodies against JSON Schema compiled with AJV using OpenAPI component schemas, with fast paths and collected error details.
Buffer a stream of items into adaptive batches with async cargo, flushing on size or timing thresholds so slow items never block the queue.
Pull remote pages lazily through an async generator, batching records per yield so consumers control pacing and memory stays flat.
Race a promise against a timer so a slow dependency cannot hold a request open indefinitely, aborting the underlying signal when the deadline passes.
Implement response-layer retry in Axios via a custom interceptor with attempt counters, exponential backoff, and idempotency-aware opt-in.
Search a sorted array in logarithmic time, returning the index of a match or the insertion point when the value is absent.
Smooth bursty traffic with Bottleneck using a token reservoir, rolling rate limit, and prioritized scheduled jobs that respect a fixed quota.
Enqueue background jobs with BullMQ backed by Redis, configure exponential backoff retries, and process them in a worker with failure handling.
Parse fetched HTML with Cheerio to extract OpenGraph metadata, clean text, and attribute values without executing any page scripts.
Split an array into fixed-size batches for bulk inserts, pagination, or parallel processing without mutating the original input.
Define a GitHub Actions CI pipeline with a Node version matrix, dependency caching, conditional deployment job, and pinned action versions.
Build a git-style CLI with Commander using nested subcommands, variadic arguments, option conflict rules, and typed hook-driven configuration.
Compose a list of functions so each wraps the next, matching the middleware style used by many web frameworks.
Split a CSV line into fields while respecting quoted values that contain commas or escaped quotes, a step that naive splitting gets wrong.
Parse CSV as a stream with csv-parse, validate each row against a schema, and pipe valid records onward while collecting row-level errors.
Curry a function so partial application returns a new function until every argument is supplied, enabling reusable configured variants.
Convert timestamps between timezones with Dayjs and its UTC plugin, keeping wall-clock semantics intact and formatting per-locale output.
Debounce wraps a callback so it runs only after activity stops for a set wait, collapsing bursts of calls into a single trailing invocation.
Remove duplicate records that share a key, keeping the first or last occurrence so the result is deterministic and easy to reason about.
Clone nested objects and arrays without sharing references, using the structured clone algorithm so dates, maps, and cycles are handled correctly.
Merge nested config objects where later sources override earlier scalars but nested objects are combined recursively, a common layering need.
Handle Docker stop signals in Node so in-flight requests drain, background jobs checkpoint, and the process exits within the grace period.
Layer environment configuration from shared defaults through environment-specific files up to process environment with explicit override rules.