Skip to content

Instantly share code, notes, and snippets.

@n0madic
n0madic / sysprofiler.sh
Last active April 10, 2026 10:40
sysprofiler.sh — Compact POSIX system profiler for LLM agents. Zero-install, read-only, Linux-only. Structured key=value output covering: identity, CPU, memory, storage, network, GPU, software, services, security, users, containers, scheduled tasks, kernel, processes, env, and health checks.
#!/bin/sh
# sysprofiler.sh — Compact system profile for LLM agents
# Pure POSIX sh | Read-only | Zero-install | Linux only
# Usage: sh sysprofiler.sh
# Output: structured key=value sections, optimized for LLM token economy
LC_ALL=C; export LC_ALL
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
_t0=$(date +%s 2>/dev/null)
func convertToUTF8(str string, origEncoding string) string {
strBytes := []byte(str)
byteReader := bytes.NewReader(strBytes)
reader, _ := charset.NewReaderLabel(origEncoding, byteReader)
strBytes, _ = ioutil.ReadAll(reader)
return string(strBytes)
}
@n0madic
n0madic / k8s-master-backup-create.sh
Created September 12, 2019 06:57
Kubermetes master backup/restore
#!/bin/bash
set -euo pipefail
docker exec -e ETCDCTL_API=3 $(docker ps -q --filter name=k8s_etcd) \
etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/peer.crt \
--key=/etc/kubernetes/pki/etcd/peer.key \
snapshot save /var/lib/etcd/snapshotdb
@n0madic
n0madic / k8s-backup.sh
Created October 26, 2018 14:34
Script that makes backup copies of all kubernetes cluster manifests
#!/bin/bash
GLOBALRESOURCES="${GLOBALRESOURCES:-"storageclass clusterrole clusterrolebinding customresourcedefinition"}"
RESOURCETYPES="${RESOURCETYPES:-"deployment daemonset configmap secrets service ingress networkpolicy statefulset cronjob pvc"}"
CONTEXT="${KUBE_CONTEXT:-$(kubectl config current-context)}"
[ -d "${CONTEXT}" ] || mkdir -p "${CONTEXT}"
kube_export() {
local NS=$1