Skip to content

Instantly share code, notes, and snippets.

View r10r's full-sized avatar

Ruben Jenster r10r

  • Drachenfels GmbH
  • Pforzheim
View GitHub Profile
#!/bin/sh
# enable debug logging
set -x
# abort if subshell command exits non-zero
set -e
. $(dirname $(readlink -f $0))/utils.sh
CRIO_LXC_BUILD_DEPS="musl musl-tools libc6-dev pkg-config git wget make ca-certificates"
install_cni() {
@r10r
r10r / http_capture.go
Created February 16, 2021 11:17
Capture HTTP network packages with gopacket/pcap
package main
import (
"github.com/google/gopacket"
//"github.com/google/gopacket/layers"
"flag"
"fmt"
"github.com/google/gopacket/pcap"
)
@r10r
r10r / qrcode.go
Created February 16, 2021 11:13
Generate simple QRCode
package main
import (
qrcode "github.com/skip2/go-qrcode"
"io/ioutil"
"os"
)
func main() {
/*
@r10r
r10r / prepare-commit-msg
Last active February 11, 2021 21:50
auto signoff git commit hook
#!/bin/sh
# Save me too .git/hooks/prepare-commit-msg and make me executable
# Thanks goes to https://stackoverflow.com/questions/15015894/git-add-signed-off-by-line-using-format-signoff-not-working
NAME=$(git config user.name)
EMAIL=$(git config user.email)
if [ -z "$NAME" ]; then
echo "empty git config user.name"
exit 1
@r10r
r10r / .bash_profile
Created February 8, 2021 14:46
macOS terminal settings
# use `csh -s /bin/bash` to change default shell to /bin/bash
# get back history as it should work
export SHELL_SESSION_HISTORY=0
# silence warning that zsh is now the default shell
export BASH_SILENCE_DEPRECATION_WARNING=1
@r10r
r10r / clear-logs.sh
Last active February 3, 2021 20:09
crio-lxc-tools
#!/bin/sh
echo "[truncate runtime logfiles]"
rm -rf /var/log/crio-lxc/*
touch /var/log/crio-lxc/crio-lxc.log
echo > /var/log/calico/cni/cni.log
dmesg -C
echo "------------------"
echo
@r10r
r10r / DOC.md
Last active November 20, 2020 19:00
crio-lxc documentation

About

This is a wrapper around LXC which can be used as a drop-in container runtime replacement for use by CRI-O.

Installation

For the installation of the runtime see INSTALL.md
For the installation and initialization of a kubernetes cluster see K8S.md

@r10r
r10r / 10-kubeadm.conf
Last active November 20, 2020 15:48
kubernetes installation (distribution independent)
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generate at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
@r10r
r10r / pre-commit
Created October 16, 2020 20:11
go fmt pre-commit hook
#!/bin/bash
for file in $(git diff --cached --name-only --diff-filter=ACMRTUXB | grep "\.go")
do
echo "(gofmt) $file"
gofmt -w $file
git add "$file"
done
@r10r
r10r / killchld.sh
Created October 13, 2020 13:35
Terminate background processes on SIGTERM
#!/bin/sh
CLD=""
echo $$
killchld() {
echo "killing $CLD"
kill -TERM $CLD
}
trap 'killchld' 15
sleep 60 &
CLD="${CLD} $!"