tags: chatgpt, java, api
Hi guys 👋 I'm sure you enjoy using chat GPT to produce, optimise, or translate code from any programming language to Java.
Today I'll show you how to use OpenAI ChatGPT API with Java, it's pretty easy.
[versions] | |
# API | |
minApi = "29" | |
targetApi = "34" | |
# Build | |
buildTools = "30.0.3" | |
gradle = "8.3.2" | |
jvmTarget = "17" | |
jetifier = "1.0.0-beta10" | |
# DI |
tags: chatgpt, java, api
Hi guys 👋 I'm sure you enjoy using chat GPT to produce, optimise, or translate code from any programming language to Java.
Today I'll show you how to use OpenAI ChatGPT API with Java, it's pretty easy.
package lv.org.substance.crypt | |
import java.security.spec.AlgorithmParameterSpec; | |
import java.security.spec.KeySpec; | |
import javax.crypto.Cipher; | |
import javax.crypto.SecretKey; | |
import javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEKeySpec; | |
import javax.crypto.spec.PBEParameterSpec; |
package demo.plain; | |
import org.keycloak.OAuth2Constants; | |
import org.keycloak.admin.client.CreatedResponseUtil; | |
import org.keycloak.admin.client.Keycloak; | |
import org.keycloak.admin.client.KeycloakBuilder; | |
import org.keycloak.admin.client.resource.RealmResource; | |
import org.keycloak.admin.client.resource.UserResource; | |
import org.keycloak.admin.client.resource.UsersResource; | |
import org.keycloak.representations.idm.ClientRepresentation; |
--- | |
version: '3.8' | |
services: | |
zookeeper-1: | |
image: confluentinc/cp-zookeeper:5.5.1 | |
ports: | |
- '32181:32181' | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 32181 | |
ZOOKEEPER_TICK_TIME: 2000 |
import Oauth2Scheme from '@nuxtjs/auth-next/dist/schemes/oauth2' | |
import { encodeQuery } from '@nuxtjs/auth-next/dist/utils' | |
export default class KeycloakScheme extends Oauth2Scheme { | |
logout () { | |
if (this.options.endpoints.logout) { | |
const opts = { | |
client_id: this.options.clientId, | |
post_logout_redirect_uri: this._logoutRedirectURI | |
} |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
#!/usr/bin/env bash | |
# install mdbtools first! | |
# mdbtools: https://github.com/brianb/mdbtools | |
# ref: https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL | |
DBMS=postgres | |
for MDB in `ls | grep .mdb$` |
embed-server --server-config=custom-full-ha.xml --empty-config --remove-existing | |
# Extensions first | |
batch | |
/extension=org.jboss.as.clustering.infinispan:add | |
/extension=org.jboss.as.clustering.jgroups:add | |
/extension=org.jboss.as.connector:add | |
/extension=org.jboss.as.deployment-scanner:add | |
/extension=org.jboss.as.ee:add | |
/extension=org.jboss.as.ejb3:add | |
/extension=org.jboss.as.jaxrs:add |
# best practice: linux | |
nano ~/.pgpass | |
*:5432:*:username:password | |
chmod 0600 ~/.pgpass | |
# best practice: windows | |
edit %APPDATA%\postgresql\pgpass.conf | |
*:5432:*:username:password | |
# linux |