Skip to content

Instantly share code, notes, and snippets.

@ppetko
ppetko / cMonitor
Last active June 4, 2022 21:18
cMonitor - Docker monitoring for the state of the containers
#!/bin/bash
set -o pipefail
critical=0
state_replicated=0
state_swarm=0
DATE=`date +%Y-%m-%d-%H:%M:%S`
@ppetko
ppetko / main.go
Created August 24, 2017 16:16 — forked from mschoebel/main.go
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
@ppetko
ppetko / docker-status.sh
Last active June 2, 2022 13:04
Bash script that checks status for docker swarm services and nodes.
#!/bin/bash
#####################################################################################
## docker-status.sh - Bash script that checks status for docker swarm services and nodes.
## Functions:
# check_replication - Check if all stacks are running in service.
# check_swarm_nodes - Check if all nodes are reacheble and healthy.
# check_swarm_services - Check if any of the services failed.
#####################################################################################
@ppetko
ppetko / Makefile
Created February 28, 2019 15:16 — forked from aprxi/Makefile
Makefile_docker_20190214
# --------------------------------------------------------------------
# Copyright (c) 2019 LINKIT, The Netherlands. All Rights Reserved.
# Author(s): Anthony Potappel
#
# This software may be modified and distributed under the terms of the
# MIT license. See the LICENSE file for details.
# --------------------------------------------------------------------
# If you see pwd_unknown showing up, this is why. Re-calibrate your system.
PWD ?= pwd_unknown
/*
For this implementation I'm using third party service for getting random data.
*/
package main
import (
"fmt"
"io/ioutil"
"net/http"
@ppetko
ppetko / random.go
Last active April 5, 2019 16:12
Random String
/*
Sources of randomness from the environment include inter-keyboard
timings, inter-interrupt timings from some interrupts, and other
events which are both non-deterministic and hard for an
outside observer to measure. Randomness from these sources are
added to an entropy pool, which is mixed using a CRC-like function.
As random bytes are mixed into the entropy pool, the routines keep
an estimate of how many bits of randomness have been stored into
the random number generator internal state.
@ppetko
ppetko / starred.go
Last active April 18, 2019 02:51
Total starred repos of each member in Gjango Github organization
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
@ppetko
ppetko / get-operator.sh
Last active November 16, 2019 13:49
Download Operators
#!/bin/bash
DATE=$(date +%Y-%m-%d-%H:%M:%S)
function log(){
echo "$DATE INFO $@"
return 0
}
function panic(){
@ppetko
ppetko / prettyBashLogging.sh
Created May 28, 2020 14:51
Pretty bash logger
#!/bin/bash
DATE=`date +%Y-%m-%d-%H:%M`
NCOLORS=$(tput colors)
if [ $? -eq 0 ] && [ $NCOLORS -gt 0 ]; then
BOLD=$(tput bold)
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
BLUE=$(tput setaf 6)
## Red Hat AMQ Streams
### Red Hat AMQ Streams is a massively scalable, distributed, and high performance data streaming platform based on the Apache Kafka® project. AMQ Streams provides an event streaming backbone that allows microservices and other application components to exchange data with extremely high throughput and low latency.
### The core capabilities include:
* A pub/sub messaging model, similar to a traditional enterprise messaging system, in which application components publish and consume events to/from an ordered stream
* The long term, fault-tolerant storage of events
* The ability for a consumer to replay streams of events
* The ability to partition topics for horizontal scalability