Skip to content

Instantly share code, notes, and snippets.

@k8scat
k8scat / generate_cert.sh
Last active April 9, 2021 16:11
Generate letsencrypt certs via certbot in docker with pre_hook and post_hook.
#!/bin/bash
set -e
domain=$1
email=$2
pre_hook=$3
post_hook=$4
if [[ -z "${domain}" || -z "${email}" ]]; then
echo "usage: $0 <domain> <email> [pre_hook] [post_hook]"
exit 1
@k8scat
k8scat / extract-credentials.groovy
Created April 13, 2021 08:22 — forked from pedrohdz/extract-credentials.groovy
Export credentials for Jenkins Configuration as Code (JCasC)
// This Jenkins Groovy script extracts credentials in Jenkins and outputs them
// in a JSON format that can be digested by "Jenkins Configuration as Code".
// Just pass the output into a JSON to YAML converter. You can run this
// through the Jenkins Script Console or similar.
//
// Thank you:
// - https://github.com/tkrzeminski/jenkins-groovy-scripts/blob/master/show-all-credentials.groovy
//
// To conver to YAML `json2yaml | sed '/^[[:space:]]*$/d'`
//
@k8scat
k8scat / install_xsel.sh
Created April 15, 2021 06:27
Install xsel in CentOS 7
#!/bin/bash
#
# Install xsel in CentOS 7
set -e
curl -LO https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/x/xsel-1.2.0-15.el7.x86_64.rpm
sudo rpm -Uvh xsel-1.2.0-15.el7.x86_64.rpm
sudo yum install -y xsel
@k8scat
k8scat / .vimrc
Created April 16, 2021 09:40
Personal simple vim configuration file
set history=500
set ts=4
set expandtab
set nu
set encoding=utf-8
set laststatus=2
syntax enable
@k8scat
k8scat / install_docker_centos.sh
Last active April 17, 2021 11:06
Install docker on CentOS
#!/bin/bash
#
# Install Docker on CentOS
# Maintainer: k8scat@gmail.com
set -e
# Uninstall old versions
yum remove docker \
docker-client \
docker-client-latest \
@k8scat
k8scat / install_docker_ubuntu.sh
Last active April 17, 2021 11:05
Install Docker on Ubuntu
#!/bin/bash
#
# Install Docker on Ubuntu
# Maintainer: k8scat@gmail.com
set -e
# Uninstall old versions
apt-get remove -y docker docker-engine docker.io containerd runc
# SET UP THE REPOSITORY
@k8scat
k8scat / install_compose.sh
Last active April 17, 2021 11:05
Install DockerCompose
#!/bin/bash
#
# Install DockerCompose
# Maintainer: k8scat@gmail.com
set -e
#version=1.28.2
version=$1
curl -L "https://github.com/docker/compose/releases/download/${version}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@k8scat
k8scat / install_python3.8_ubuntu16.sh
Last active April 17, 2021 16:54
Install Python3.8 on Ubuntu 16
#!/bin/bash
#
# Install Python3.8 and pip on Ubuntu 16
# Maintainer: k8scat@gmail.com
set -e
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update -y
apt-get install -y python3.8 python3.8-distutils
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
@k8scat
k8scat / install_kubeadm_kubelet_kubectl.sh
Last active April 18, 2021 15:07
Install kubeadm, kubelet and kubectl
#!/bin/bash
#
# Install kubeadm, kubelet and kubectl
# Maintainer: k8scat@gmail.com
set -e
# 更新 apt 包索引并安装使用 Kubernetes apt 仓库所需要的包
apt-get update -y
apt-get install -y apt-transport-https ca-certificates curl
@k8scat
k8scat / pull_k8s_images.sh
Created April 18, 2021 15:12
Pull K8S images - v1.21.0
#!/bin/bash
#
# Pull K8S images
# Version: 1.21.0
# Maintainer: k8scat@gmail.com
set -e
# Pull images from aliyun registry
kubeadm config images list | sed -e 's/^/docker pull /g' -e 's#k8s.gcr.io#registry.cn-shenzhen.aliyuncs.com/k8scat#g' -e 's#/coredns/coredns#/coredns#g' | sh -x