Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / asp_dotnet_blazor_workshop_live.md
Last active January 25, 2023 18:03
ASP.NET Core 6 Blazor App Workshop - Instructor Live Readme

ASP.NET Core 6 Blazor App Workshop - Instructor Live Readme

Live workshop notes and flow are below. Use this as a reference day of the workshop to make sure you hit all the main points.

Introduction

Explain application here

Developer Setup

  1. Setup Developer Workspace (30min)
@jkeam
jkeam / firefox-websockets.md
Created July 19, 2022 06:05
How to enable insecure websockets in Firefox.
  1. Go to this url in your Firefox browser: about:config
  2. Then search for network.websocket.allowInsecureFromHTTPS and toggle it on
@jkeam
jkeam / create-quarkus-project.sh
Last active August 2, 2022 04:56
Quarkus Command Examples
#!/bin/bash
# standard api
quarkus create app --verbose --refresh --maven --java=11 --package-name=io.keam \
--extensions=resteasy-reactive,resteasy-reactive-jackson,hibernate-orm-rest-data-panache,jdbc-postgresql,smallrye-jwt,smallrye-jwt-build \
--app-config=quarkus.datasource.db-kind=postgresql,quarkus.datasource.username=root,quarkus.datasource.password=root,quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/todo_app,quarkus.hibernate-orm.database.generation=drop-and-create \
io.keam:quarkus-todo:1.0.0-SNAPSHOT
# reactive api
# quarkus create app --verbose --refresh --maven --java=11 --package-name=io.keam \
@jkeam
jkeam / drop-forwarded-headers.java
Last active August 3, 2022 16:04
Drop all forwarded headers
import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.context.annotation.Bean;
@Bean
public ForwardedHeaderFilter disabledForwardedHeaderFilter() {
ForwardedHeaderFilter filter = new ForwardedHeaderFilter();
filter.setRemoveOnly(true);
return filter;
}
@jkeam
jkeam / Dockerfile-forever
Created August 8, 2022 17:19
Dockerfile to run container forever
FROM docker.io/redhat/ubi8-micro
USER nobody
ENTRYPOINT ["tail", "-f", "/dev/null"]
# Get odo for linux
$ curl -OL https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.0.0/odo-linux-amd64 && mv odo-linux-amd64 odo && chmod u+x odo
$ export PATH=$PATH:$(pwd)
$ odo version
# Use git to check out the .NET Core application
$ git clone https://github.com/redhat-developer/s2i-dotnetcore-ex
$ cd s2i-dotnetcore-ex/app
$ git checkout dotnetcore-3.1
@jkeam
jkeam / create-kafka-cluster.yaml
Created August 22, 2022 17:36
AMQ Streams create Kafka
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
labels:
app: my-app
namespace: openshift-operators
spec:
kafka:
config:
@jkeam
jkeam / cat-facts.sql
Created August 24, 2022 03:27
SQL Script to load cat facts.
insert into facts(id, fact) values (nextval('hibernate_sequence'), 'The penalty for killing a cat, 4,000 years ago in Egypt, was death.');
insert into facts(id, fact) values (nextval('hibernate_sequence'), '95% of all cat owners admit they talk to their cats.');
insert into facts(id, fact) values (nextval('hibernate_sequence'), 'More cats are left-pawed than right-pawed. Out of 100 cats approximately 40 are left-pawed, 20 are right-pawed, and 40 are ambidextrous.');
insert into facts(id, fact) values (nextval('hibernate_sequence'), 'A cat can jump as much as seven times its height.');
insert into facts(id, fact) values (nextval('hibernate_sequence'), 'A cat cannot see directly under its nose. This is why the cat cannot seem to find tidbits on the floor.');
insert into facts(id, fact) values (nextval('hibernate_sequence'), 'A cat has 230 bones in its body. A human only has 206 bones.');
insert into facts(id, fact) values (nextval('hibernate_sequence'), 'A cat has four rows of whiskers.');
insert into facts(id,
@jkeam
jkeam / QuarkusCat.java
Created August 24, 2022 03:30
Java Files for Quarkus Catfact App
package io.keam.models;
import io.quarkus.hibernate.orm.panache.PanacheEntity;
import javax.persistence.*;
@Entity
@Table(name = "facts")
public class Fact extends PanacheEntity {
@Column
public String fact;

Quarkus Demo

Run App

  1. Create App
quarkus create app --java=11 --package-name=io.keam \
    --extensions=resteasy-reactive,resteasy-reactive-jackson,hibernate-orm-rest-data-panache,jdbc-postgresql \
    --app-config=quarkus.hibernate-orm.database.generation=drop-and-create,quarkus.hibernate-orm.sql-load-script=import-dev.sql \
    io.keam:catfacts:1.0.0-SNAPSHOT