Skip to content

Instantly share code, notes, and snippets.

View diceone's full-sized avatar

Michael Vogeler diceone

  • Hamburg
View GitHub Profile
@diceone
diceone / xmrig.service
Created May 23, 2021 15:15 — forked from Ernillew/xmrig.service
systemd-unit for xmrig
[Unit]
Description=XMRig Daemon
After=network.target
[Service]
Type=forking
GuessMainPID=no
ExecStart=/usr/local/bin/xmrig -c /home/miner/config/config.json -l /home/miner/xmrig.log -B
Restart=always
User=miner
# this is a bag of functions sourced by another script
if [[ $BASH_VERSINFO -lt "4" ]]; then
echo "!! Your system Bash is out of date: $BASH_VERSION"
echo "!! Please upgrade to Bash 4 or greater."
exit 2
fi
if [[ $EUID -ne 0 ]]; then
echo "!! This script must be run as root"
@diceone
diceone / install-k3s.sh
Created August 15, 2020 13:51 — forked from mattkenn4545/install-k3s.sh
K3s/Rancher install script
#!/bin/env bash
set -e
export PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
: <<'README'
# Master node install, note this script /should/ be idempotentish. Rerunning to get worker node command output is fine
sudo -E ./install-k3s.sh
# to skip install of rancher
SKIP_RANCHER_INSTALL=true sudo -E ./install-k3s.sh
@diceone
diceone / create_user_and_kubeconfig_rancher2.sh
Created June 3, 2020 11:22 — forked from superseb/create_user_and_kubeconfig_rancher2.sh
Create local user and generate kubeconfig in Rancher 2 via API
#!/bin/bash
RANCHERENDPOINT=https://your_rancher_endpoint/v3
# The name of the cluster where the user needs to be added
CLUSTERNAME=your_cluster_name
# Username, password and realname of the user
USERNAME=username
PASSWORD=password
REALNAME=myrealname
# Role of the user
GLOBALROLE=user
@diceone
diceone / terraform-install.sh
Created March 31, 2020 13:45 — forked from danisla/terraform-install.sh
Terraform latest version install script
#!/bin/bash
function terraform-install() {
[[ -f ${HOME}/bin/terraform ]] && echo "`${HOME}/bin/terraform version` already installed at ${HOME}/bin/terraform" && return 0
LATEST_URL=$(curl -sL https://releases.hashicorp.com/terraform/index.json | jq -r '.versions[].builds[].url' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | egrep -v 'rc|beta' | egrep 'linux.*amd64' |tail -1)
curl ${LATEST_URL} > /tmp/terraform.zip
mkdir -p ${HOME}/bin
(cd ${HOME}/bin && unzip /tmp/terraform.zip)
if [[ -z $(grep 'export PATH=${HOME}/bin:${PATH}' ~/.bashrc) ]]; then
echo 'export PATH=${HOME}/bin:${PATH}' >> ~/.bashrc
@diceone
diceone / install.sh
Created November 7, 2019 12:02 — forked from random-robbie/install.sh
Install helm for kubernetes on centos 7
#!/bin/bash
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.12.2-linux-amd64.tar.gz
tar -zxvf helm-v2.12.2-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
kubectl -n kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
kubectl create namespace kubeapps
helm install --name kubeapps --namespace kubeapps bitnami/kubeapps
@diceone
diceone / k8s-pi.md
Created January 14, 2018 11:41 — forked from alexellis/k8s-pi.md
K8s on Raspbian

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup

@diceone
diceone / sensu_report
Created December 26, 2017 10:27 — forked from solarkennedy/sensu_report
A script to report on the failed checks from sensu. Great for putting in the motd: sensu_report -s my_sensu_server > /etc/motd
#!/usr/bin/env python2
import json,sys,urllib2,socket
GREEN = '\033[92m'
RED = '\033[91m'
CLEAR = '\033[0m'
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-s", "--server", dest="server",
@diceone
diceone / go-shebang-story.md
Created December 25, 2017 14:52 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@diceone
diceone / go-shebang-story.md
Created December 25, 2017 14:52 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.