Skip to content

Instantly share code, notes, and snippets.

View robertoschwald's full-sized avatar

Robert Oschwald robertoschwald

View GitHub Profile
@robertoschwald
robertoschwald / GrailsDomainConfiguration.groovy
Created February 19, 2016 13:32
Grails 2.4.x PostgreSQL duplicate primary keys, indexes, unique keys dbm-gorm-diff workaround
/*
* Copyright 2013-2016 symentis GmbH - All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@robertoschwald
robertoschwald / ApacheEmailValidator.java
Last active August 10, 2017 11:32
Hibernate ApacheEmailValidator. Use instead of @pattern or @Email to let Apache Commons EmailValidator do the validation.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
@robertoschwald
robertoschwald / SampleEntity.java
Last active August 11, 2017 15:04
TABLE_PER_CLASS and MySQL / Galera PK problem possible workaround
// Due to MySQL's lack of sequences, Hibernate 5.x would use TABLE identity if
// setting strategy = @GeneratedValue(strategy = GenerationType.AUTO).
// This currently does not work with Galera Cluster, as it needs a PK
// which is not defined by the default hibernate sequence table "hibernate_sequence",
// so DDL will fail and the application does not work as expected.
// One Trick would be to define our own TableGenerator which holds a PK like below.
// Disadvantages:
// - performance (generally a problem when using GenerationType.TABLE)
// - not the best option for a DB agnostic application, when other DB types support SEQUENCE.
@robertoschwald
robertoschwald / grails-quartz-2.2.1-db-migration.groovy
Last active February 1, 2018 10:28
Grails 3.x Quartz-Plugin 2.0.0 Database-Migration migration file to create the MySQL / MariaDB InnoDB DB tables for Quartz
// Grails database-migration plugin changeLog for Quartz 2.2.1 DB Tables (Grails Quartz-Plugin 2.0.0)
// Add this migration file to the migrations folder, register in changelog.groovy and add to the dbm config in application.yml/roovy:
// grails.plugin.databasemigration.excludeObjects = ['QRTZ_BLOB_TRIGGERS', 'QRTZ_CALENDARS', 'QRTZ_CRON_TRIGGERS', 'QRTZ_FIRED_TRIGGERS', 'QRTZ_JOB_DETAILS', 'QRTZ_LOCKS', 'QRTZ_PAUSED_TRIGGER_GRPS', 'QRTZ_SCHEDULER_STATE', 'QRTZ_SIMPLE_TRIGGERS', 'QRTZ_SIMPROP_TRIGGERS', 'QRTZ_TRIGGERS']
// See http://svn.terracotta.org/svn/quartz/tags/quartz-2.2.1/distribution/src/main/assembly/root/docs/dbTables/tables_mysql_innodb.sql
databaseChangeLog = {
changeSet(author: "r.o. (manual)", id: "1476893806-1") {
sql('''
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
@robertoschwald
robertoschwald / application.groovy
Last active November 15, 2018 11:11
Grails 3.x Quartz-Plugin 2.0.0 application.groovy example configuration for clustering support
quartz {
autoStartup = true
jdbcStore = true
waitForJobsToCompleteOnShutdown = true
// Allows monitoring in Java Melody (if you have the java melody plugin installed in your grails app)
exposeSchedulerInRepository = true
scheduler {
instanceName = 'my_quartz'
instanceId = 'AUTO'
@robertoschwald
robertoschwald / build.gradle.xrebel.groovy
Created November 29, 2018 10:29
Run Grails 3.x with XRebel
// To use XRebel in Grails 3.3.x, add to build.gradle bootRun block.
// Then you are able to conditionally enable XRebel by specifying "-Dxrebel=<path_to_xrebel>"
if (System.getProperty('xrebel')){
if (new File(System.getProperty('xrebel')).exists()){
jvmArgs "-javaagent:${System.getProperty('xrebel')}"
} else {
println "XRebel file ${System.getProperty('xrebel')} not found. Ignoring"
}
}
@robertoschwald
robertoschwald / createOSXInstallerIso
Created October 26, 2017 17:00
Create OSX installer ISO file (example for High Sierra)
#!/usr/bin/env bash
# Create OSX Installer ISO.
# 2017 robertoschwald
# https://gist.github.com/robertoschwald/7f9eadf78739128ea1fb7a32c0472e1c
installer_path=/Applications/Install\ macOS\ High\ Sierra.app
installer_mountpoint=/Volumes/Install\ macOS\ High\ Sierra
echo "Creating Install ISO"
@robertoschwald
robertoschwald / application.yml
Last active November 15, 2019 00:09
Grails 3.x Quartz-Plugin 2.0.0 application.yml configuration for clustering support
quartz:
autoStartup: true
jdbcStore: true
sheduler:
instanceName: myapp_quartz
instanceId: AUTO
skipUpdateCheck: true
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 5
@robertoschwald
robertoschwald / GitHubEnterprise.ovf
Last active September 13, 2020 07:08
GitHub Enterprise 2.8.7 fixed OVF file for vCenter 6.5
<?xml version="1.0" encoding="UTF-8"?>
<!-- Manually converted to vCenter 6.5 format by roos
Note: You must update the GitHubEnterprise.mf sha1 fingerprint of this file.
This version fixes the OVF import error in vCenter 6.5 ("..ProductInfo not allowed in Envelope..")
-->
<!--Generated by VMware ovftool 3.5.0 (build-1274719), UTC time: 2017-01-26T19:38:58.786729Z-->
<Envelope vmw:buildId="build-1274719" xmlns="http://schemas.dmtf.org/ovf/envelope/1"
xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
@robertoschwald
robertoschwald / mod_jk.spec
Created August 19, 2020 10:43
mod_jk RPM Spec file for CentOS8
%{!?apxs: %{expand: %%define apxs %{_bindir}/apxs}}
%define httpd httpd
Name: mod_jk
Version: 1.2.48
Release: 1%{?org_tag}%{?dist}
Epoch: 0
Summary: Tomcat mod_jk connector for Apache
License: Apache License