Skip to content

Instantly share code, notes, and snippets.

View Segmentational's full-sized avatar

Jacob B. Sanders Segmentational

View GitHub Profile
@Segmentational
Segmentational / main.go
Created August 13, 2024 08:15
Go HTTP Proxy
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
"time"
// Package namesgenerator generates random names.
//
// This package is officially "frozen" - no new additions will be accepted.
//
// For a long time, this package provided a lot of joy within the project, but
// at some point the conflicts of opinion became greater than the added joy.
//
// At some future time, this may be replaced with something that sparks less
// controversy, but for now it will remain as-is.
//
@Segmentational
Segmentational / Deployment.yaml
Created February 25, 2024 01:50
Kubernetes Deployment Downward API Environment Variables
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-deployment
labels:
name: api-deployment
spec:
replicas: 2
selector:
@Segmentational
Segmentational / Dockerfile
Last active February 18, 2024 23:29
Optimized GO HTTP Server Dockerfile - Kubernetes, Private VCS Compatible
# syntax = docker/dockerfile:1.0-experimental
FROM golang:1.22-alpine as BUILD
# ARG NETRCPASSWORD
# ENV NETRCPASSWORD "${NETRCPASSWORD}"
# ENV GOPRIVATE "github.com/example/*"
ENV GOOS "linux"
ENV GOVCS "*:all"
@Segmentational
Segmentational / main.go
Created December 18, 2023 08:59 — forked from creack/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@Segmentational
Segmentational / Security.Bash
Created August 2, 2023 20:12
Fedora, CentOS, Security Update Script
#!/bin/bash --posix
# -*- Coding: UTF-8 -*- #
# -*- System: Linux -*- #
# -*- Usage: *.* -*- #
# See Bash Set-Options Reference Below
set -euo pipefail # (0)
set -o xtrace # (6)
@Segmentational
Segmentational / Template.Bash
Created August 2, 2023 19:59
Default Bash Template, Personal
#!/bin/bash --posix
# -*- Coding: UTF-8 -*- #
# -*- System: Linux -*- #
# -*- Usage: *.* -*- #
# Author: Jacob Sanders (GitHub - Segmentational)
# See Bash Set-Options Reference Below
@Segmentational
Segmentational / clean.bash
Created November 10, 2022 17:46
Node Directory + JS Clean-Up
find . -name "node_modules" -type "d" -exec "rm -rf {} || true" \;
find . -name "*.js" -type "f" -exec rm -f {} \;
find . -name "*.js.map" -type "f" -exec rm -f {} \;
find . -name "*.d.ts" -type "f" -exec rm -f {} \;
find . -name "*.ts.map" -type "f" -exec rm -f {} \;
find . -name "*.d.ts.map" -type "f" -exec rm -f {} \;
@Segmentational
Segmentational / walker.ts
Created October 5, 2022 04:58
Recursive Parent-Child Walker
import Cryptography from "crypto";
/***
* @example
* void (async () => {
* const parent = new Abstract("root");
*
* const child = new Abstract("child-1", parent);
*
* new Abstract("child-3", child);
@Segmentational
Segmentational / .npmrc
Last active September 13, 2022 21:09
Custom Workstation + GitLab `.npmrc` File
; For reference, every programming language's package-manager
; has a similar *.*rc (dot-rc) related setup (few exceptions
; include Go, C, etc.)
;
; Defaults := $ npm config ls --list
; -> $ npm config ls --json
fund = false
cache = ~/.npm