Skip to content

Instantly share code, notes, and snippets.

View YamadaKaito's full-sized avatar

Daniel B K YamadaKaito

View GitHub Profile
@YamadaKaito
YamadaKaito / docker-howto.txt
Created April 14, 2021 04:35 — forked from ruanbekker/docker-howto.txt
Some Docker Howto Command Line Examples
My Docker Notes. I will post more in future on details about Docker, Docker Compose, Docker Swarm on my blog under:
https://sysadmins.co.za/tag/docker
Get Docker:
# curl -sSL https://get.docker.io | bash
Docker Hub:
Search:
# docker search ubuntu
@YamadaKaito
YamadaKaito / cheatsheet-elasticsearch.md
Created April 14, 2021 04:34 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@YamadaKaito
YamadaKaito / setup-golang.sh
Created April 14, 2021 04:34 — forked from ruanbekker/setup-golang.sh
Setup Golang on Linux
#!/usr/bin/env bash
mkdir -p ~/workspace/go
cd /tmp
wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
tar -xf go1.8.1.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
rm -rf go1.8.1.linux-amd64.tar.gz
echo 'export GOPATH=$HOME/workspace/go' >> ~/.profile
echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.profile

:WIP:

Docker

Docker Volumes

  • nocopy

The nocopy modifier is for when you are creating a volume and data already exists in the container's path, you can specify if you want that data copied when the volume is created.

@YamadaKaito
YamadaKaito / parse_json_bash.md
Created April 14, 2021 04:33 — forked from ruanbekker/parse_json_bash.md
Extract values from a json string in bash

parse.sh

#!/bin/sh
buffer=$(cat)

name=$(echo $buffer | jq -r '.source.name')
surname=$(echo $buffer | jq -r '.source.surname')

echo "Hello ${name}, ${surname}"
@YamadaKaito
YamadaKaito / openssl_encryption.md
Created April 14, 2021 04:33 — forked from ruanbekker/openssl_encryption.md
Encryption/Decryption with OpenSSL

Encryption

$ openssl enc -aes-256-cbc -in un_encrypted.data -out encrypted.data

Decryption

$ openssl enc -d -aes-256-cbc -in encrypted.data -out un_encrypted.data
@YamadaKaito
YamadaKaito / rest_api.go
Created April 14, 2021 04:32 — forked from ruanbekker/rest_api.go
Rest API in Golang
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/rs/xid"
)
@YamadaKaito
YamadaKaito / letsencrypt-docker.md
Created April 14, 2021 04:31 — forked from ruanbekker/letsencrypt-docker.md
Generate Letsencrypt Certificate with Docker
mkdir letsencrypt
docker run -ti --rm -v "$(pwd)"/letsencrypt:/etc/letsencrypt \
certbot/certbot --manual --preferred-challenges dns certonly -d sub.domain.com
@YamadaKaito
YamadaKaito / mac_docker_swarm.sh
Created April 14, 2021 04:31 — forked from ruanbekker/mac_docker_swarm.sh
Setup Docker-in-Docker Swarm
#!/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" ]