Skip to content

Instantly share code, notes, and snippets.

@isapir
isapir / .name
Last active September 7, 2024 22:14
IDEA Lucee
Lucee 6
ARG TOMCAT_VERSION=9.0.70
ARG BASE_JAVA_IMAGE=azul/zulu-openjdk-alpine:11-jre-latest
ARG TOMCAT_FILENAME="apache-tomcat-${TOMCAT_VERSION}"
ARG CATALINA_HOME_DIR=/srv/www/catalina-home
ARG CATALINA_HOME=${CATALINA_HOME_DIR}/${TOMCAT_FILENAME}
ARG CATALINA_BASE=/srv/www/catalina-base
## Image size 238MB
## image size 1.36GB
FROM alpine AS nginx-builder
ARG NGINX_VERSION=1.23.1
ARG OPENSSL_VERSION=3.0.7
ARG ZLIB_VERSION=1.2.13
ARG NGINX_DIR=/usr/local/nginx
RUN apk --update add bash curl perl vim pcre-dev build-base linux-headers \
&& mkdir -p /usr/local/src && cd /usr/local/src \
FROM ubuntu:22.04
ENV NGINX_VERSION=1.23.3
ENV NGINX_BIN=/usr/sbin/nginx
ENV NGINX_LOG=/var/log/nginx
ENV NGINX_CONF=/etc/nginx
@isapir
isapir / Dockerfile-tomcat
Last active December 20, 2022 16:24
Dockerfile for Tomcat running as non-root user
FROM eclipse-temurin:11-jdk-jammy
## allow to set a user id and group to match the host user for easy file sharing
ARG USER_ID=1000
## Tomcat version
ARG TOMCAT_VERSION=9.0.70
ENV SETUP_DIR "/var/local/tomcat"
ENV USER_ID ${USER_ID}
@isapir
isapir / setup-tomcat
Last active December 16, 2022 07:05
Setup Tomcat to run as a non-Root user on Ubuntu
USER_ID=1000
TOMCAT_VERSION=9.0.70
TOMCAT_FILENAME=apache-tomcat-${TOMCAT_VERSION}
SETUP_DIR=/var/local/tomcat
mkdir -p ${SETUP_DIR} && cd ${SETUP_DIR}
/** converts http cookie header to json using split */
create or replace function httpcookie2json(cookie text)
returns text language plpgsql as
$body$
declare
arr text[];
el text;
pos int;
k text;
v text;
/** print stack trace */
Thread = createObject("java", "java.lang.Thread");
Arrays = createObject("java", "java.util.Arrays");
systemOutput(Arrays.toString(Thread.currentThread().getStackTrace()), true, true);
systemOutput(callStackGet("text"), true, true);
<cfscript>
algorithm = "PBKDF2withHmacSha512";
passphrase = "The passphrase is passphrase";
// 16 random characters
salt = left(replace(createUUID(), "-", "", "all"), 16);
// approx. 300ms at the time of testing
component {
this.algorithms = {
"HS256" : "HMACSHA256"
};
/**
* initializes the object with the secret that is used to sign the JWT
*/