Skip to content

Instantly share code, notes, and snippets.

View bluebrown's full-sized avatar

Nico Braun bluebrown

View GitHub Profile
@bluebrown
bluebrown / Makehelp.awk
Last active April 23, 2025 09:56
awk script to generate a help text from a Makefile
#!/usr/bin/env -S gawk -f
BEGIN {
init_theme()
print_usage()
# split targets and options
FS = "(:.*##|?=)"
}
# options:: <var> ?= <default>
@bluebrown
bluebrown / batch_request_handler.go
Created December 21, 2021 09:47
Go HTTP Batch Request Handler
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/http/httptest"
"net/textproto"
@bluebrown
bluebrown / compute-note.js
Last active June 18, 2021 05:51
Compute musical note from arbitrary scale
export function computeNote(
// how far from the base note to go in either direction
distance = 0,
scale = {
// use this frequency as basis
// standard A4 is 440hz
base: 440.0,
// claim that its in the 4 repetition of made up sequence,
// on a normal piano it is saying this is A4
position: 4,
@bluebrown
bluebrown / s3authentication.py
Last active April 20, 2021 14:36
Authenticate for AWS S3 request
from datetime import datetime
from hashlib import sha256
import hmac
import requests
from os import environ as env
# templates for creating the auth header
Canonical_Request = '{HTTPMethod}\n{CanonicalURI}\n{CanonicalQueryString}\n{CanonicalHeaders}\n\n{SignedHeaders}\n{HashedPayload}'
Scope = '{DATE}/{REGION}/{SERVICE_NAME}/{KIND}'
@bluebrown
bluebrown / slider.css
Last active March 8, 2020 20:14
Slider
:root {
overflow: hidden;
--slide-transition: all 2s ease 0s;
--image-height: 300px;
--image-padding: 0.2vw;
--image-opacity: 0.5;
--image-left: 0%;
--wrap-width: 100%;
--wrap-right: 00%;