Skip to content

Instantly share code, notes, and snippets.

View nexus166's full-sized avatar
🌪️
🐧

nexus166

🌪️
🐧
  • Earth
View GitHub Profile
@nexus166
nexus166 / bkp.sh
Last active October 25, 2019 02:14
tar backup w/ attributes/perms/max compression
#!/bin/sh
GZIP=-9 tar acfpvz ${1} ${2}
  • install basic stuff
apt install -y apt-transport-https arptables ca-certificates ebtables gnupg2 haveged openssl dirmngr
  • add gpg keys & repos, install docker
wget -qO- https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
wget -qO- https://download.docker.com/linux/debian/gpg | apt-key add -
{
@nexus166
nexus166 / nginx.conf
Last active October 22, 2019 23:54
NGINX config file
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
@nexus166
nexus166 / daemon.json
Created October 21, 2019 17:02
docker daemon config
{
"experimental": true,
"iptables": true,
"ip-masq": false,
"fixed-cidr": "10.192.0.0/16",
"ipv6": true,
"fixed-cidr-v6": "fd90:cafe:babe::/48",
"log-driver": "json-file",
"log-opts": {"max-size": "10m", "max-file": "3"}
}
case $- in
*i*) :;;
*) return;;
esac
HISTCONTROL=ignorespace
shopt -s histappend
HISTSIZE=-1
shopt -s checkwinsize
#!/usr/bin/env bash
set -eo pipefail
deps=(cryptsetup fdisk openssl ssh-keygen)
for _d in ${deps[@]}; do command -v "${_d}"; done
RSA_PUBKEY="${1}"
[[ -z "${RSA_PUBKEY}" ]] && read -p "Enter path to RSA public key (autogenerated): " RSA_PUBKEY
[[ -z "${RSA_PUBKEY}" ]] && export RSA_PUBKEY=~/.ssh/id_rsa.pub && ssh-keygen -N '' -f ~/.ssh/id_rsa
@nexus166
nexus166 / k8run.sh
Created October 12, 2019 22:27
clean one-time container run in kube
#!/usr/bin/env bash
function k8run() {
set -xu;
IMAGE="${1}";
PODNAME=$(basename "${IMAGE}" | tr ':' '-');
_ARGS=("${@:2}");
KUBE_ARGS=$(printf '"%s", ' "${_ARGS[@]}");
PRIVILEGED="${PRIVILEGED:-false}";
kubectl run "${PODNAME}-${USER}" --restart=Never -it --rm --attach --image overriden --overrides '
#!/usr/bin/env bash
function w8() {
for p in "${@}";
do
wait -n "${p}" 2> /dev/null &
done;
wait -n
}
#!/usr/bin/env bash
set -eo pipefail
TARGETs=(${@})
avg_lat() { basename $(ping -s 4096 -c 10 -q "${1}" | awk '/avg/ {print $4}'); }
w8() { c=0; for p in ${@}; do (wait ${p} 2>/dev/null || c=$?) & done; wait; }
work() { echo -e "$(avg_lat ${1})\\t${1}\\t$(curl -s ipinfo.io/${1} | jq -r '.loc,.country,.region' | tr '\n' '\t')"; }
pids=()
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.14.3 # change according to kubeadm supported version
apiServer:
certSANs:
- 127.0.0.1
- cluster-api.example.com # change according to your requirements
extraArgs:
authorization-mode: Node,RBAC
feature-gates: "TTLAfterFinished=true"