Skip to content

Instantly share code, notes, and snippets.

View Genzer's full-sized avatar

Genzer Hawker Genzer

View GitHub Profile
@Genzer
Genzer / LoadAllReachableCmsesCommand.java
Created August 2, 2016 09:25
Obtain all CMSes from RELEASED `IProcessModelVersion`.
class LoadAllReachableCmsesCommand implements Callable<Set<IContentManagementSystem>> {
@Override
public Set<IContentManagementSystem> call() throws Exception {
Set<IContentManagementSystem> cmses = new HashSet<>();
for (IProcessModelVersion pmv : allReachablePmvs()) {
IContentManagementSystem cms = Ivy.cms()
.getContentManagement().findCms(pmv);
if (cms != null) {
cmses.add(cms);
@Genzer
Genzer / RunOnceOnServerStartEventBean.java
Created August 11, 2016 04:28
How to implement a background job which starts only ONCE on Axon.ivy Engine PMV starts.
import java.util.*;
import ch.ivyteam.ivy.process.eventstart.*;
import ch.ivyteam.ivy.request.RequestException;
import ch.soreco.alag.exception.OperationFailedException;
/**
* The {@code RunOnceOnServerStartEventBean} is an Ivy start event bean
* {@linkplain IProcessStartEventBean}. It's is designed to start a process only
* <strong>ONCE</strong> on the server startup.
@Genzer
Genzer / query_all_running_cases_in_a_particular_pmv_of_an_axonivy_engine.sql
Created August 18, 2016 03:53
Use this script to list all running ICase (Axon.ivy) in a particular IProcessModelVersion
use axonivysystemdatabase;
-- state = 1 means RUNNING
declare @pmv_id int
set @pmv_id = 123456 -- set your PMV's Id here
select cx.*, te.processmodelversionid from
(select c.*, ts.taskelementid as 'taskelementid' from iwa_case c left join iwa_taskstart ts on c.taskstartid = ts.taskstartid) cx
@Genzer
Genzer / WebcontentResourceLoader.java
Created October 27, 2016 09:16
Get `Path` to resource located in Axon.ivy project `webContent`
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import org.eclipse.core.resources.IFolder;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.security.internal.SecurityManager;
@Genzer
Genzer / .tmux.conf
Created December 14, 2017 07:53
Genzer's tmux.conf
unbind C-b
set -g prefix `
bind ` send-prefix
# PREFIX \: Create a new vertial pane.
bind \ split-window -h
# PREFIX -: Create a new horizontal pane.
bind - split-window -v
@Genzer
Genzer / StreamingWithRecursion.java
Created April 2, 2019 04:55
This gist explores how to use `Stream` with a tree-like data structure
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* This class is a test to see if we can use `Stream`
* to walk/explore a tree-like data structure.
*/
public class StreamingWithRecursion {
@Genzer
Genzer / CreateJenkinsUser.groovy
Created August 1, 2019 04:33
Create new Jenkins user using RoleBasedStrategy and Groovy script
import hudson.model.*
import hudson.security.*
import hudson.tasks.Mailer
import com.michelin.cio.hudson.plugins.rolestrategy.*
/*
* This snippet is inspired from a StackOverflow question and answer.
* https://stackoverflow.com/questions/17716242/creating-user-in-jenkins-via-api
*/
@Genzer
Genzer / .replace_relative_import_js
Last active August 29, 2019 07:57
Find and replace Javascript relative imports.
This file is solely for being Gist's name.
@Genzer
Genzer / add_git_alias_to_list_all_aliases.sh
Last active October 29, 2020 03:31
My attempt to list all git aliases plus colors
#!/bin/bash -e
# I went through some hard time editing the ~/.gitconfig and finally gave up because
# escaping the single-quotes was too hard.
# Finally, I left the job to Bash and Git CLI.
# Save for future use.
# CHANGELOG
# v2
# - Change the way to process the alias: replace the first `=` with a `#`.
@Genzer
Genzer / icedtea-web-install-macos.sh
Created July 1, 2020 16:13
A convenient script to install Zulu IcedTea Web Portable version 1.8.3 on macOS.
#!/usr/bin/env bash
# A convenient script to install Zulu IcedTea Web Portable version 1.8.3
# on macOS.
# It can run with most of the JRE/JDK 8 Distribution like Oracle JDK
# or AdoptOpenJDK.
set -e