Skip to content

Instantly share code, notes, and snippets.

View DrSnowbird's full-sized avatar
🏄‍♀️
Focusing

DrSnowbird DrSnowbird

🏄‍♀️
Focusing
View GitHub Profile
# Create a deployment
kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
# Create a service
kubectl expose deployment hello-minikube --type=NodePort
# List the pods
kubectl get pod
# List the service
@DrSnowbird
DrSnowbird / global-replace.sh
Last active August 23, 2018 21:37
To search and replace for any matched pattern in the current directory including all the sub-directory.
#!/bin/bash -x
## Note: this script has dependency on "ack" utility.
if [ $# -lt 2 ]; then
echo "--------- Synopsis--------"
echo "Synopsis: Globally replace an old pattern withe a new text string for all directories given"
echo "Usage: $0 <old_pattern> <new_text> [directory, default: ./]"
echo "e.g."
echo " $0 '=logging\/' '/root/logging_files\/' /home/ec2-user/all/ansible/roles"
#
# example1-volume.yaml
#
- hosts: localhost
tasks:
- name: check if myvolume exists
command: docker volume inspect myvolume
register: myvolume_exists
failed_when: false
@DrSnowbird
DrSnowbird / generate-Docker-CA-cert-server-client-cert.sh
Created July 25, 2018 22:24
generate-Docker-CA-cert-server-client-cert
#!/bin/bash -x
# ref: https://docs.docker.com/engine/security/https/
mkdir CA-server-client-keys
cd CA-server-client-keys/
## Create a CA, server and client keys with OpenSSL
## ----------------------------------------------------------------------------
#!/bin/bash
## references:
## 1.) https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs
function usage() {
if [ $# -lt 1 ]; then
echo "----------------------------------------------------------------------"
echo "---------------------------- USAGE -----------------------------------"
echo "----------------------------------------------------------------------"
## find ports being used
sudo netstat -antup |awk '{print $4;}'|cut -d':' -f2 |sort -u
#!/bin/bash
# ------------------------------------
# maintainer: [email protected]
# license: Apache License Version 2.0
# ------------------------------------
# This feature is not yet available for native Docker Windows containers.
# On Linux and when using Docker for Mac or Docker for Windows or
# Docker Toolbox,
#!/bin/bash -x
if [ $# -lt 3 ]; then
echo "ERROR: --- Usage: $0 <config_file> <key> <value> [<delimiter>] [<prefix-pattern>]"
echo "e.g."
echo './replaceKeyValue.sh \"elasticsearch.yml\" \"^network.host\" \"172.20.1.92\" \":\" \"# network\" '
exit 1
fi
CONFIG_FILE=${1}
#!/bin/bash
# ------------------------------------
# maintainer: [email protected]
# license: Apache License Version 2.0
# ------------------------------------
ERROR_NO_ARGS_PROVIDED=99
ERROR_ERROR_ARGS_PROVIDED=98
@DrSnowbird
DrSnowbird / DCOS_vagrant_up.sh
Last active March 28, 2018 03:50
DCOS Local cluster using Vagrant
#!/bin/bash -x
# ref: https://github.com/dcos/dcos-vagrant
if [ ! -d dcos-vagrant ]; then
git clone https://github.com/dcos/dcos-vagrant
fi
cd dcos-vagrant
if [ ! -s VagrantConfig.yaml ]; then