Skip to content

Instantly share code, notes, and snippets.

Petr Michalec epcim

View GitHub Profile
@epcim
epcim / disable-ipv6.sh
Created Jul 1, 2020 — forked from kwilczynski/disable-ipv6.sh
Amazon Linux OS tweaks
View disable-ipv6.sh
#!/bin/bash
set -u
set -e
set -o pipefail
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
cat <<'EOF' > /etc/modprobe.d/blacklist-ipv6.conf
@epcim
epcim / systemd_loging.sh
Last active Jun 11, 2020
bash snippet for systemd logging functions
View systemd_loging.sh
#!/bin/bash
printf_stdin() { local stdin; read -d '' -u 0 stdin; printf "$@" "$stdin"; }
exec {log_fd}> >(systemd-cat -t $(basename $0))
log_emerg() { echo "EMERG: $1"|tee /dev/stderr| printf_stdin '<0>%s\n' "$1" >&"$log_fd"; }
log_alert() { echo "ALERT: $1"|tee /dev/stderr| printf_stdin '<1>%s\n' "$1" >&"$log_fd"; }
log_crit() { echo "CRIT: $1" |tee /dev/stderr| printf_stdin '<2>%s\n' "$1" >&"$log_fd"; }
log_err() { echo "ERROR: $1"|tee /dev/stderr| printf_stdin '<3>%s\n' "$1" >&"$log_fd"; }
log_warn() { echo "WARN: $1" |tee /dev/stderr| printf_stdin '<4>%s\n' "$1" >&"$log_fd"; }
@epcim
epcim / instructions.md
Created Mar 24, 2020 — forked from douglasmiranda/instructions.md
Add email to Keybase.io PGP Key (Public Key)
View instructions.md

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
@epcim
epcim / keybase.md
Created Mar 24, 2020 — forked from webframp/keybase.md
Signing git commits on github using keybase.io gpg key
View keybase.md

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@epcim
epcim / az.md
Last active Feb 19, 2020
Azure az queries
View az.md

Interesting Ops queris for Azure / AKS

Account, Subscription

az account list --query '[*].{Name:name}' --output table

Resource groups

List:

@epcim
epcim / indexer
Last active Feb 13, 2020
udev rules ordered interface
View indexer
#!/bin/sh
#if [ $# -lt 1 ]; then
# echo "Usage: $0 prefix [initial] [database/file] " >&2
# exit 1
#fi
key="${1:-"eth"}"
initial="${2:-0}"
datfile="${3:-/run/indexerdb_$key}"
@epcim
epcim / k8s_job_replay.sh
Last active Jan 7, 2020
kubernetes job
View k8s_job_replay.sh
kubectl get job -n sre kibana-config -o json | jq 'del(.spec.selector)' | jq 'del(.spec.template.metadata.labels)' | kubectl replace --force -f -
@epcim
epcim / kubernetes_pods_docker_disk_usage.md
Last active Jul 1, 2020
docker disk space introspection kubernetes docker overlay
View kubernetes_pods_docker_disk_usage.md

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

@epcim
epcim / hab clustered etcd
Created Sep 16, 2019
etcd habitat docker-compose hab
View hab clustered etcd
# See more: https://gist.github.com/epcim/80d2dda18e2b3022e4ab07f161f59823
# hab clustered etcd
## compose
cat <<EOF > docker-compose.yml
version: '3'
services:
etcd1:
@epcim
epcim / wait_for_http_200.sh
Created Aug 26, 2019 — forked from rgl/wait_for_http_200.sh
Wait for an HTTP endpoint to return 200 OK with Bash and curl
View wait_for_http_200.sh
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
You can’t perform that action at this time.