Skip to content

Instantly share code, notes, and snippets.

View josnidhin's full-sized avatar

Jose Davis Nidhin josnidhin

View GitHub Profile
@josnidhin
josnidhin / http_request.js
Last active January 14, 2021 06:50
Simple Nodejs http request without external dependencies
'use strict';
const HTTP = require('http'),
HTTPS = require('https'),
PROTOCOL = {
HTTP: 'http:',
HTTPS: 'https:'
};
function request (opts, data) {
@josnidhin
josnidhin / thresholdbarrier.go
Created May 8, 2026 15:09
An implementation of capacity-aware synchronization primitive that I named ThresholdBarrier. It can be used to answer the question "Is there enough capacity to fetch another batch for processing?" eg: fetching from SQS only when there is capacity to process.
/**
* @author Jose Nidhin
*/
package main
import (
"context"
"fmt"
"math/rand"