Skip to content

Instantly share code, notes, and snippets.

View shubham14bajpai's full-sized avatar
🎯
Focusing

Shubham Bajpai shubham14bajpai

🎯
Focusing
View GitHub Profile
@shubham14bajpai
shubham14bajpai / Concurrency.md
Last active October 14, 2026 08:42
Concurrency Simple

Problem Statement: Concurrent Worker Pool for Task Processing

Scenario

You are building a backend service in Go that receives a slice of integer job IDs (e.g., [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]). Processing each job involves a simulated time-consuming operation (such as making an HTTP call or querying a database), which takes 500 milliseconds.

Processing 10 jobs sequentially takes roughly 5 seconds. To improve throughput, write a program that uses a worker pool of 3 concurrent goroutines to process all tasks in parallel.

package main

Coding Assessment: Thread-Safe Database Connection Pool (Golang)

Business Context

You are building the database connectivity layer for CommandCentral Vault, Motorola Solutions' secure digital evidence management system.

When major incidents occur, hundreds of concurrent microservices request database connections to fetch body-cam metadata, evidence audit logs, and chain-of-custody records. Standard database drivers can crash if opened without strict concurrency limits.

Your goal is to build a custom, highly efficient Thread-Safe Connection Pool (DBPool) that manages connection lifecycles, caps active connection limits, enforces acquisition timeouts using context.Context, reaps idle connections, and handles graceful teardown.

@shubham14bajpai
shubham14bajpai / question.md
Last active October 1, 2026 06:08
question

Coding Assessment: Concurrent Event Ingestion Pipeline (Golang)

Business Context

You are tasked with building the backend ingestion engine for Avigilon Control Center (ACC), an enterprise video security and access control platform.

High-definition edge cameras and License Plate Recognition (ALPR) readers installed across commercial campuses continuously stream detection events (e.g., license plate scans, badge swipes, vehicle classifications). During morning rush hours, traffic spikes significantly.

Your goal is to build a real-time Access & LPR Event Processor that:

  1. Ingests event streams from camera nodes.
  2. Buffers events safely during traffic spikes.
## input
{
"items": [
{
"metadata": { "name": "auth-service-789", "namespace": "prod" },
"status": { "phase": "Running" },
"spec": {
"containers": [
{
"name": "auth-api",
#include <iostream>
#include <string>
#include <map>
#include "standings.h"
using namespace std;
struct Team {
int win;
int loss;
@shubham14bajpai
shubham14bajpai / Snapshot-Migration.md
Last active June 12, 2020 05:59
Steps to migrate snapshot migration after migrating cstor volumes to CSI spec.
  1. Make sure the volume migration is successful. Follow the volume migration steps from the docs.

  2. Get the yamls for old volumesnapshot and volumesnapshotdata.

    • List old volumesnapshots and
    mayadata:cstor$ kubectl get volumesnapshots.volumesnapshot.external-storage.k8s.io
    NAME                  AGE
    snapshot-demo-cstor   7s
    • Select the snapshot to migrate and get the -o yaml output.
@shubham14bajpai
shubham14bajpai / Control-Plane-Migration.md
Last active June 12, 2020 04:56
Migrating OpenEBS setup to another namespace.

OpenEBS set with one jiva volume in default namespace.

mayadata:setup$ kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
openebs-admission-server-8695fd778c-n4tw7                         1/1     Running   0          3m32s
openebs-apiserver-66f7f86b55-7fdtl                                1/1     Running   2          3m32s
openebs-localpv-provisioner-58cc756c78-tmfmp                      1/1     Running   0          3m32s
openebs-ndm-c2w7s                                                 1/1     Running   0          3m32s
openebs-ndm-operator-6f7f9c6778-qjhfn                             1/1     Running   1          3m32s
openebs-provisioner-5bd587c6c5-lhwrm                              1/1     Running   0          3m32s