Skip to content

Instantly share code, notes, and snippets.

@shoaib42
shoaib42 / giphy-httpstatus.sh
Created October 26, 2026 16:38
Custom fun status pages for haproxy, apache, etc.
#!/usr/bin/env bash
set -euo pipefail
DO_HAPROXY=0
DO_HTML=0
usage() {
cat >&2 <<EOF
Usage: $0 [--haproxy] [--html] <http_code> <giphy_id_or_url> [Custom Message]
--haproxy generate <code>.http for HAProxy errorfile
@shoaib42
shoaib42 / README.md
Last active October 26, 2026 15:55
Homebrew and failing GNU mirrors

brewcurl: pick your own GNU mirror for Homebrew

The problem

Many Homebrew formulae download from ftpmirror.gnu.org, a redirector that picks a mirror for you. When it picks a dead or overloaded one, brew upgrade hangs, and because upgrades run as a batch, one stalled download blocks everything. The URLs are hardcoded in formulae and the host is HTTPS, so DNS rewrites (AdGuard, /etc/hosts) fail on certificate and path mismatches.

@shoaib42
shoaib42 / FastUUID.scala
Created August 9, 2022 14:14
Fast psuedo UUID generation in Scala
import java.util.concurrent.ThreadLocalRandom
import scala.annotation.tailrec
object FastUUID extends App {
val hex = "0123456789abcdef".toCharArray
def fastUUID(): String = {
val msbees = ThreadLocalRandom.current.nextLong()
val lsbees = ThreadLocalRandom.current.nextLong()
@shoaib42
shoaib42 / RedisSimulationJava.java
Last active February 19, 2022 18:22
Testing RPOPLPUSH for gatling feeder
package computerdatabase;
import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;
import static io.gatling.javaapi.redis.RedisDsl.redisFeeder;
import io.gatling.javaapi.core.*;
import io.gatling.javaapi.http.*;
import io.gatling.javaapi.redis.RedisFeederBuilder;
@shoaib42
shoaib42 / APC_UPS_grafana_dashboard.json
Created December 12, 2021 06:51
56quarters / apcmetrics grafana dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",