Skip to content

Instantly share code, notes, and snippets.

@oskapt
oskapt / rc.netdata
Last active December 13, 2023 12:49
Netdata init script for Synology DSM
#!/bin/bash
# Install this as `/etc/rc.netdata` and call it from `/etc/rc.local`
# to have it executed on boot.
NETDATA_DIR=/opt/netdata
DAEMON=$NETDATA_DIR/bin/srv/netdata
TIMEOUT=30 # seconds to wait for netdata to exit
[ -x $DAEMON ] || exit 0
#!/usr/bin/env bash
mkdir certs my-safe-directory
cat > ca.cnf <<EOF
# OpenSSL CA configuration file
[ ca ]
default_ca = CA_default
[ CA_default ]
default_days = 365
@oskapt
oskapt / e08-handout.md
Created August 27, 2019 15:18
Scripts and commands for https://youtu.be/09bsaCkLfw4

Hello! This gist goes with this video, which covers shortcuts and strategies for working with the K8s command line. You can see all of my videos on YouTube at https://adrian.goins.tv.

Scripts

I use Fish as my shell, but I know that a lot of people are using Bash. Here are two ways to concatenate config files for kubectl into the KUBECONFIG environment variable. If you're using zsh or tcsh you'll know how to convert these to your shell's format.

You can call these from your shell init file, or if you want to temporarily disable a script, append .bak or .disabled to its extension and run the script manually.

You can even hotkey it on something like the Elgato Stream Deck.

@oskapt
oskapt / dohproxy.conf
Created October 6, 2019 13:33
DoH Proxy Config
##
# Individual DoH server entries, one server per resolver.
# These establish proxy ports that the upstream resolvers
# can be reached via.
##
server {
listen 8001 default_server;
server_name _;
location / {
proxy_pass https://dns.google;
@oskapt
oskapt / delete-cs-resources.sh
Last active September 25, 2019 10:55
Delete stuck containership K8s resources
kubectl get authorizationrolebinding.auth.containership.io \
| tail -n +2 | awk '{ print $1 }' | while read x; do
kubectl get -o yaml authorizationrolebinding.auth.containership.io/$x -o json | jq '.metadata.finalizers=[]' \
| kubectl apply -f -;
done
kubectl get authorizationrole.auth.containership.io \
| tail -n +2 | awk '{ print $1 }' | while read x; do
kubectl get -o yaml authorizationrole.auth.containership.io/$x -o json | jq '.metadata.finalizers=[]' \
| kubectl apply -f -;
@oskapt
oskapt / cloud-config.txt
Created September 25, 2019 03:05
Cloud config for RKE hosts
#cloud-config
package_upgrade: true
package_update: true
packages:
- curl
- nfs-kernel-server
- python3-pip
runcmd:
- curl -s -o /var/tmp/install_docker https://releases.rancher.com/install-docker/18.09.sh
kubectl -n kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller \
--clusterrole=cluster-admin \
--serviceaccount=kube-system:tiller
helm init --service-account tiller
@oskapt
oskapt / velero-aws-setup-combined.sh
Last active September 24, 2019 21:21
Velero AWS Setup Script
#!/bin/bash
# Set BUCKET and REGION before continuing. If you want to use a
# different IAM user name or if you use a different AWS profile
# for connecting, you can set those as well.
BUCKET=
REGION=
VELERO_USER=velero
AWS_PROFILE=default
@oskapt
oskapt / velero-install-aws.sh
Created September 24, 2019 21:19
Velero install command
velero install \
--provider aws \
--bucket $BUCKET \
--secret-file ./credentials-velero \
--backup-location-config region=$REGION \
--snapshot-location-config region=$REGION \
--use-restic
@oskapt
oskapt / instance-policy.json
Created September 24, 2019 21:16
IAM Instance Policy JSON for Rancher
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:AttachVolume",
"ec2:CreateSnapshot",
"ec2:CreateTags",
"ec2:CreateVolume",