Skip to content

Instantly share code, notes, and snippets.

:octocat:

Ruan Bekker ruanbekker

:octocat:
Block or report user

Report or block ruanbekker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ruanbekker
ruanbekker / swarm.yml
Created Jun 15, 2019 — forked from MetalArend/swarm.yml
Run a GitLab Runner on your Swarm
View swarm.yml
version: '3.4'
secrets:
# Find your registration token at: "Your project" > "Settings" > "CI/CD" > "Runners settings" > "Specific Runners" (look for registration token)
# Register it as `GITLAB_REGISTRATION_TOKEN`: `docker secret create GITLAB_REGISTRATION_TOKEN YOUR_REGISTRATION_TOKEN`
GITLAB_REGISTRATION_TOKEN:
external: true
# Find your personal access token at: "Your user account" > "Settings" > "Access Tokens" > "Create personal access token" (for api)
# Register it as `GITLAB_PERSONAL_ACCESS_TOKEN`: `docker secret create GITLAB_PERSONAL_ACCESS_TOKEN <YOUR ACCESS TOKEN>`
@ruanbekker
ruanbekker / index_center.html
Created Jun 9, 2019
Center Image in Center of Page in HTML
View index_center.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="python web page for kubernetes demo">
<meta name="keywords" content="kubernetes,python,web">
<meta name="author" content="Ruan Bekker">
<title>Python Page</title>
@ruanbekker
ruanbekker / boto3_emr_create_cluster_with_wordcount_step.py
Created Mar 21, 2017
Create EMR Cluster with a Wordcount Job as a Step in Boto3
View boto3_emr_create_cluster_with_wordcount_step.py
import boto3
client = boto3.client(
'emr',
region_name='eu-west-1'
)
cmd = "hadoop jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar wordcount file:///etc/services /output"
emrcluster = client.run_job_flow(
@ruanbekker
ruanbekker / flask-client-ip.py
Created Jun 7, 2017
Python Flask Show Client IP
View flask-client-ip.py
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/ip', methods=['GET'])
def name():
return request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
#return jsonify({'ip': request.remote_addr}), 200
#return jsonify({'ip': request.environ['REMOTE_ADDR']}), 200
@ruanbekker
ruanbekker / setup-kubernetes-ubuntu-16.md
Last active Jun 4, 2019
Install a 3 Node Kubernetes Cluster on Ubuntu 16
View setup-kubernetes-ubuntu-16.md

Master: Dependencies

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
@ruanbekker
ruanbekker / mac_docker_swarm.sh
Last active May 27, 2019
Setup Docker-in-Docker Swarm
View mac_docker_swarm.sh
#!/bin/bash
# Credit: https://callistaenterprise.se/blogg/teknik/2017/12/18/docker-in-swarm-mode-on-docker-in-docker/
# https://hub.docker.com/_/docker?tab=tags
# https://www.blog.labouardy.com/docker-swarm-networking-and-dynamic-reverse-proxy/
SWARM_ENABLED=true
DOCKER_VERSION=18.06.3-ce-dind
NUM_WORKERS=3
if [ ${SWARM_ENABLED} == "false" ]
@ruanbekker
ruanbekker / random_num.sh
Created May 25, 2019
Selecting Random Numbers in BASH
View random_num.sh
# create the array
for x in {1..1000}
do
array[$x]="$x"
done
# print random number between 1-1000
size=${#array[@]}
echo ${array[$(($RANDOM % $size))]}
@ruanbekker
ruanbekker / docker-nfs-volumes.md
Created Dec 10, 2017
NFS Volumes with Docker Swarm
View docker-nfs-volumes.md

Create NFS Volumes:

Creating the NFS Volume:

$ docker volume create --driver local \
  --opt type=nfs \
  --opt o=addr=192.168.1.115,uid=1000,gid=1000,rw \
  --opt device=:/mnt/volumes/mysql-test \
  mysql-test-1
You can’t perform that action at this time.