This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 123.123.123.123 password" | |
echo "Specify your host's LAN IP and the desired Pihole password" | |
exit 1 | |
fi | |
IP=$1 | |
PASSWORD=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deploy-kube: | |
stage: deploy | |
environment: test | |
image: dtzar/helm-kubectl:2.12.3 | |
script: | |
- kubectl config set-cluster sophia-cluster --server=${KUBE_URL} --certificate-authority="${KUBE_CA_PEM_FILE}" | |
- kubectl config set-credentials sophia-admin --token=${KUBE_TOKEN} | |
- kubectl config set-context sophia-context --cluster=sophia-cluster --user=sophia-admin --namespace ${KUBE_NAMESPACE} | |
- kubectl config use-context sophia-context | |
- helm upgrade --reuse-values --set image.tag=$CI_BUILD_REF sophia k8s-chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib | |
import sys | |
text = sys.argv[1] | |
encoded = urllib.quote_plus(text) | |
print encoded | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
#set -e | |
k3d delete --name='rio' | |
k3d create -n rio --image rancher/k3s:v0.8.1 --publish 80:80 --publish 443:443 --publish 9443:9443 --publish 9080:9080 && | |
declare -i i; i=0 | |
until k3d get-kubeconfig --name='rio' | |
do | |
if (( i > 20 )); then | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: | |
name: hashicorp/terraform:light | |
entrypoint: | |
- '/usr/bin/env' | |
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | |
before_script: | |
- rm -rf .terraform | |
- terraform --version | |
- mkdir -p ./creds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
podTemplate( | |
label: 'kubernetes', | |
containers: [ | |
containerTemplate(name: 'maven', image: 'maven:alpine', ttyEnabled: true, command: 'cat'), | |
containerTemplate(name: 'golang', image: 'golang:alpine', ttyEnabled: true, command: 'cat') | |
] | |
) { | |
node('kubernetes') { | |
container('maven') { | |
stage('build') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate AWS credentials through https://console.aws.amazon.com/iam/home#/security_credential if you do NOT have them already | |
export AWS_ACCESS_KEY_ID=[...] # Replace [...] with the AWS Access Key ID | |
export AWS_SECRET_ACCESS_KEY=[...] # Replace [...] with the AWS Secret Access Key | |
export AWS_DEFAULT_REGION=us-east-2 | |
# If Windows, use `tr '\r\n' ', '` instead of `tr '\n' ','` | |
export ZONES=$(aws ec2 describe-availability-zones \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################### | |
# Create The Cluster # | |
###################### | |
# Tested with minikube v0.30 | |
minikube start \ | |
--vm-driver virtualbox \ | |
--cpus 2 \ | |
--memory 10240 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Use inotify to watch a directory and execute a command on file change. | |
Watch for any file change below current directory (using inotify via pyinotify) | |
and execute the given command on file change. | |
Just using inotify-tools `while inotifywait -r -e close_write .; do something; done` | |
has many issues which are fixed by this tools: | |
* If your editor creates a backup before writing the file, it'll trigger multiple times. | |
* If your directory structure is deep, it'll have to reinitialize inotify after each change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import time | |
region = 'eu-west-1' | |
user_data_script = """#!/bin/bash | |
instanceid=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
cd / | |
mkdir moodledata | |
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-xxxxxxxxxxc.efs.eu-west-1.amazonaws.com:/ moodledata | |
tar czf mooodledata-backup-$(date +%d-%m-%Y_%H-%M).tar.gz /moodledata | |
aws s3 mv mooodledata-backup-*.tar.gz s3://xxxxxxxxx/ |