Skip to content

Instantly share code, notes, and snippets.

View sshaaf's full-sized avatar

Syed M Shaaf sshaaf

View GitHub Profile
package org.acme;
import java.util.Random;
public class SentenceGenerator {
private static final String[] subjects = {"The cat", "A wizard", "The dragon", "An astronaut", "A pirate"};
private static final String[] verbs = {"jumps over", "casts a spell on", "breathes fire at", "explores", "steals"};
private static final String[] objects = {"the moon", "a treasure chest", "a castle", "a spaceship", "a secret island"};
public static String getSentenceWords(int wordLength) {
@sshaaf
sshaaf / gist:354d87dcaef7c37cb8a2caf9f604bb03
Created November 13, 2024 15:55
Jlama, Quarkus, langchain4J.. stack trace.
┌───────────────────> 🐠
│quarkus-drools-llm is 📦 v1.0.0-SNAPSHOT
└─> java --enable-preview --enable-native-access=ALL-UNNAMED --add-modules jdk.incubator.vector -jar target/quarkus-app/quarkus-run.jar (base)
WARNING: Using incubator modules: jdk.incubator.vector
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2024-11-13 16:43:16,187 INFO [io.quarkus] (main) quarkus-drools-llm 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.15.1) started in 0.476s. Listening on: http://0.0.0.0:8080
2024-11-13 16:43:16,191 INFO [io.quarkus] (main) Profile prod activated.
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.fasterxml.jackson.core:jackson-databind:2.13.3
//DEPS com.fasterxml.jackson.core:jackson-core:2.13.3
//DEPS com.fasterxml.jackson.core:jackson-annotations:2.13.3
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.math.BigInteger;
import java.util.concurrent.StructuredTaskScope;
public class ScopedValue21 {
private static final ScopedValue<BigInteger> multiplier = ScopedValue.newInstance();
public static void main(String[] args) throws Exception {
If you have already tried something like the following:
oc delete project dev --force --grace-period=0
#Most likely Kube is set in the finalizer which does not let the namespace to be removed. here is one way to do it.
kubectl get ns PROJECTNAME -o json > tmp.json
vi tmp.json
#Make sure finalizers are empty as follows
```
@sshaaf
sshaaf / LoadAndRun.py
Created November 30, 2021 14:38
Loads a mock json file(not array), reads line by line, and send it to server on a particular end-point
# python request json data loaded from a file
import requests
# reads 1 line at a time, this is not an array
file1 = open('MOCK_DATA.json', 'r')
Lines = file1.readlines()
header = {
'Content-Type': 'application/json'
@sshaaf
sshaaf / sugh.sh
Created September 29, 2021 13:54 — forked from erdincay/sugh.sh
su GitHub (downloading all repositories from a given user)
#!/bin/bash
if [ -z "$1" ]; then
echo "waiting for the following arguments: username + max-page-number"
exit 1
else
name=$1
fi
if [ -z "$2" ]; then
@sshaaf
sshaaf / GameResource.java
Created May 26, 2021 09:05
Quarkus DG8.2 Client
package org.acme.rest.json;
import io.quarkus.infinispan.client.Remote;
import io.reactivex.Observable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.infinispan.client.hotrod.RemoteCache;
import java.util.ArrayList;
import java.util.HashSet;
@sshaaf
sshaaf / CR
Last active May 21, 2021 13:33
Infinispan monitoring CR setup
apiVersion: infinispan.org/v1
kind: Infinispan
metadata:
annotations:
infinispan.org/monitoring: 'true'
infinispan.org/operatorPodTargetLabels: >-
com.redhat.component-name,com.redhat.component-type,com.redhat.component-version,com.redhat.product-name,com.redhat.product-version
selfLink: /apis/infinispan.org/v1/namespaces/atest/infinispans/example-infinispan
resourceVersion: '1195423'
name: example-infinispan