Skip to content

Instantly share code, notes, and snippets.

View hguerrero's full-sized avatar

Hugo Guerrero hguerrero

View GitHub Profile
@hguerrero
hguerrero / inventory.sql
Last active March 29, 2021 14:26
Database configuration Oracle Connector for Debezium
-- Create and populate our products using a single insert with many rows
CREATE TABLE products (
id NUMBER(4) GENERATED BY DEFAULT ON NULL AS IDENTITY (START WITH 101) NOT NULL PRIMARY KEY,
name VARCHAR2(255) NOT NULL,
description VARCHAR2(512),
weight FLOAT
);
GRANT SELECT ON products to c##dbzuser;
ALTER TABLE products ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
{
"apiVersion": "template.openshift.io/v1",
"kind": "Template",
"labels": {
"template": "postgresql-ephemeral-template"
},
"message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${POSTGRESQL_USER}\n Password: ${POSTGRESQL_PASSWORD}\n Database Name: ${POSTGRESQL_DATABASE}\n Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.",
"metadata": {
"annotations": {
"description": "PostgreSQL database service, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
kind: Template
apiVersion: template.openshift.io/v1
metadata:
annotations:
description: The Gogs git server (https://gogs.io/)
tags: instant-app,gogs,go,golang
name: gogs
objects:
- kind: ServiceAccount
apiVersion: v1
sh-5.0# kafkacat -b demo-kafka-brokers -L
Metadata for all topics (from broker -1: demo-kafka-brokers:9092/bootstrap):
1 brokers:
broker 0 at demo-kafka-0.demo-kafka-brokers.debezium-basic-demo.svc:9092 (controller)
12 topics:
topic "dbserver-mysql.inventory.orders" with 1 partitions:
partition 0, leader 0, replicas: 0, isrs: 0
topic "dbserver-mysql.inventory.geom" with 1 partitions:
partition 0, leader 0, replicas: 0, isrs: 0
topic "dbserver-mysql.inventory.addresses" with 1 partitions:
apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
creationTimestamp: '2020-09-30T15:25:55Z'
generation: 1
name: demo
namespace: debezium-basic-demo
resourceVersion: '250167'
selfLink: /apis/kafka.strimzi.io/v1beta1/namespaces/debezium-basic-demo/kafkas/demo
uid: 62f9cd82-13d0-4596-b1a2-be80d5852dce
sh-5.0# kafkacat -b demo-kafka-bootstrap -L -d all
%7|1601586435.008|WAKEUPFD|rdkafka#producer-1| [thrd:app]: demo-kafka-bootstrap:9092/bootstrap: Enabled low-latency ops queue wake-ups
%7|1601586435.008|BRKMAIN|rdkafka#producer-1| [thrd::0/internal]: :0/internal: Enter main broker thread
%7|1601586435.008|BROKER|rdkafka#producer-1| [thrd:app]: demo-kafka-bootstrap:9092/bootstrap: Added new broker with NodeId -1
%7|1601586435.008|CONNECT|rdkafka#producer-1| [thrd:app]: demo-kafka-bootstrap:9092/bootstrap: Selected for cluster connection: bootstrap servers added (broker has 0 connection attempt(s))
%7|1601586435.008|BRKMAIN|rdkafka#producer-1| [thrd:demo-kafka-bootstrap:9092/bootstrap]: demo-kafka-bootstrap:9092/bootstrap: Enter main broker thread
%7|1601586435.008|INIT|rdkafka#producer-1| [thrd:app]: librdkafka v1.1.0 (0x10100ff) rdkafka#producer-1 initialized (builtin.features snappy,ssl,sasl,regex,lz4,sasl_gssapi,sasl_plain,sasl_scram,plugins,zstd,sasl_oauthbearer, GCC GXX PKGCONFIG INSTALL GNULD C11THREADS
@hguerrero
hguerrero / openshift-icons.js
Created July 8, 2020 16:08
OpenShift Icons for Console
const logos = new Map()
.set('icon-3scale', threeScaleImg)
.set('icon-aerogear', aerogearImg)
.set('icon-amq', amqImg)
.set('icon-angularjs', angularjsImg)
.set('icon-ansible', ansibleImg)
.set('icon-apache', apacheImg)
.set('icon-beaker', beakerImg)
.set('icon-camel', camelImg)
.set('icon-capedwarf', capedwarfImg)
@hguerrero
hguerrero / unstuck.sh
Created March 16, 2020 21:46
Delete project stuck on terminating
(
NAMESPACE=your-rogue-namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)
@hguerrero
hguerrero / RegistryProducer.java
Last active November 25, 2019 21:02
quarkus-registry-example
package com.redhat;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import javax.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.reactive.messaging.Outgoing;
import io.reactivex.Flowable;
@hguerrero
hguerrero / failover
Last active October 16, 2019 19:58
Skupper instructions
# us-east
kubectl create namespace us-east
kubectl config set-context --current --namespace us-east
kubectl create deployment hello-world-frontend --image quay.io/skupper/hello-world-frontend
kubectl expose deployment/hello-world-frontend --port 8080 --type LoadBalancer
kubectl create deployment hello-world-backend-us-east --image quay.io/hguerreroo/hello-world-backend
kubectl expose deployment/hello-world-backend-us-east --port 8080 --name hello-world-backend
skupper init --cluster-local
skupper connection-token ~/secret.yaml
oc rsh hello-world-frontend-<tab>