sudo snap install lxd
sudo lxd init
#!/bin/bash | |
export vault=/usr/local/bin/vault | |
export VAULT_TOKEN=$(cat /root/.vault-token) | |
vault_cacert='-ca-cert=/path/to/your/ca.pem' | |
local_vault="-address=https://$(hostname -f):8200" | |
unsealed_vault="-address=https://$(getent hosts $(dig +short vault.service.consul | tail -n 1) | awk '{ print $2 }'):8200" | |
leader_vault="-address=https://$($vault status $vault_cacert $unsealed_vault 2> /dev/null | grep Leader | awk '{ print $2 }' | sed 's/^http\(\|s\):\/\///g'):8200" | |
vault_read="$vault read $vault_cacert $leader_vault" | |
vault_unseal="$vault unseal $vault_cacert $local_vault" |
package main | |
import "fmt" | |
func main () { | |
for i:=1; i<=100; i++ { | |
if i % 15 == 0 { | |
fmt.Println("FizzBuzz") | |
} else if i % 3 == 0 { |
''' | |
This is an example of how to send data to Slack webhooks in Python with the | |
requests module. | |
Detailed documentation of Slack Incoming Webhooks: | |
https://api.slack.com/incoming-webhooks | |
''' | |
import json | |
import requests |
<style type="text/css"> | |
@font-face { | |
font-family: 'Open Sans'; | |
font-style: normal; | |
font-weight: 300; | |
src: local('Open Sans Light'), local('OpenSans-Light'), url(http://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTa-j2U0lmluP9RWlSytm3ho.woff2) format('woff2'); | |
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; | |
} | |
.body { | |
width: 90%; |
# ref: https://coderwall.com/p/ez1x2w/send-mail-like-a-boss | |
# install mailx | |
yum -y install mailx | |
# create a directory with a certificate, to send mail using TLS | |
mkdir ~/.certs | |
certutil -N -d ~/.cert | |
# create a user ~/.mailrc, to use custom settings |
import jenkins | |
import time | |
# It comes with pip module python-jenkins | |
# use pip to install python-jenkins | |
# Jenkins Authentication URL | |
JENKINS_URL = "https://xxxx" | |
JENKINS_USERNAME = "xxxxx" | |
JENKINS_PASSWORD = "xxxxxxx" |
#!/bin/bash | |
# file: startstop.sh | |
#---- | |
# Simple script to start / stop a python script in the background. | |
#---- | |
#---- | |
# To Use: |
# List images in k8s | |
ctr --namespace k8s.io image list | |
# Create etcd snapshot | |
ctr --namespace k8s.io \ | |
run \ | |
--mount type=bind,src={{ backup_temp_dir.path }}/,dst=/backup/,options=rbind:rw \ | |
--net-host \ | |
--env ETCDCTL_API=3 \ | |
--rm "{{ etcd_image_name.stdout | trim }}" \ |
# crictl documentation: https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/ | |
# Runtime endpoints: | |
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock | |
sudo crictl --runtime-endpoint unix:///var/run/dockershim.sock | |
sudo crictl --runtime-endpoint unix:///run/crio/crio.sock | |
## Containers | |
# Get all containers |