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 / 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 / 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 / clean-up-boot-partition-ubuntu.md
Created May 17, 2019 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64
View clean-up-boot-partition-ubuntu.md

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@ruanbekker
ruanbekker / letsencrypt-docker.md
Created May 9, 2019
Generate Letsencrypt Certificate with Docker
View letsencrypt-docker.md
mkdir letsencrypt
docker run -ti --rm -v "$(pwd)"/letsencrypt:/etc/letsencrypt \
certbot/certbot --manual --preferred-challenges dns certonly -d sub.domain.com
@ruanbekker
ruanbekker / go
Created Apr 25, 2019 — forked from CarterTsai/go
golang s3 PutObject
View go
package main
import (
"bytes"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View javascript_cheatsheet.md

Arrays

Define array:

> var dict = [];

Append dictionary to array:

@ruanbekker
ruanbekker / golang_build_guide.md
Last active Apr 21, 2019
Golang Building Guide
View golang_build_guide.md

Operating System and Platform

Mac

GOOS GOARCH
darwin 386
darwin amd64
darwin arm
darwin arm64
You can’t perform that action at this time.