Skip to content

Instantly share code, notes, and snippets.

# Contexts
kcgc - kubectl config get-contexts
kcuc - kubectl config use-context [CONTEXT name]
# POD
# list pods
kgp | grep [POD]
# execute a command in a container
#!/bin/sh
docker run -d --hostname my-rabbit --name rabbitmq -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 -p 15672:15672 -p 25672:25672 rabbitmq:3-management
docker ps
http://localhost:15672
# Path to your oh-my-zsh installation.
export ZSH="/Users/cristian/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Which plugins would you like to load?
#!/bin/sh
docker network create elasticnet
docker run -d --name elasticsearch --net elasticnet -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.8.0
docker run -d --name kibana --net elasticnet -p 5601:5601 kibana:6.8.0
docker ps
http://localhost:5601
@ocristian
ocristian / docker-kafka.sh
Created June 19, 2019 21:17
docker messaging
#!/bin/sh
docker network create kafka
docker run --network=kafka -d --name=zookeeper --env ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:latest
docker run --network=kafka -d -p 9092:9092 --name=kafka --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 --env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092 --env KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:latest
docker ps
@ocristian
ocristian / unix-helpers.sh
Last active June 21, 2019 14:12
unix notes
#get port in use by info
lsof -i :PORT_NUMBER
#to create directories recursively
mkdir -p my-project/{src,public/{styles,scripts,images}}
@ocristian
ocristian / currentLocalDateTime.js
Last active April 7, 2016 06:08
to find the current local date and time based on user system
// Example: 4/7/2016 3:00 AM BRT
function currentLocalDateTime(){
var date = new Date();
var curr_year = date.getFullYear();
var curr_month = ("00" + (date.getMonth() + 1)).slice(-2);
var curr_dayOfMonth = ("00" + date.getDate()).slice(-2);
var curr_hour = date.getHours();
var curr_minute = ("00" + date.getMinutes()).slice(2);