Skip to content

Instantly share code, notes, and snippets.

View Segmentational's full-sized avatar

Jacob B. Sanders Segmentational

View GitHub Profile
@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
@Segmentational
Segmentational / socket.test.ts
Created September 9, 2022 11:17
Socket + TypeScript Functional Prototyping & Module Namespacing
import * as Network from "net";
/***
* @module Test
*
* **TSC Configuration**
*
* ```json
* {
* "compilerOptions": {
@Segmentational
Segmentational / index.ts
Last active August 30, 2022 08:04
Node CLI Argument Parsing
import Utility from "util";
process.argv = [...process.argv, "hello", "--debug", "--secrets-manager=local-azure-test", "another", "--key", "value", "--debug"];
class Arguable extends String {
position?: number;
original?: string;
constructor(value: string | Arguable) {
super(value);