Skip to content

Instantly share code, notes, and snippets.

public class TestLoadFile {
public static void main(String[] args) {
UMLResourcesUtil.initGlobalRegistries();
var registry = Resource.Factory.Registry.INSTANCE;
var m = registry.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
@sz332
sz332 / gist:81b1051e2727e936ed31383645926718
Created February 21, 2024 20:44 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@sz332
sz332 / settings.xml
Created December 17, 2023 17:05
Sirius Web Config
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
---------------------------- MODULE statemachine ----------------------------
EXTENDS TLC, Sequences, Integers
(* --algorithm statemachine
fair process webProcess = 1
variables
machineState = "Starting",
run = TRUE;
public class Chessboard {
private final int maxX;
private final int maxY;
public Chessboard(int maxX, int maxY) {
this.maxX = maxX;
this.maxY = maxY;
}
import java.util.Stack;
public class XmlValidator {
public boolean isValid(String xml) {
Stack<String> stack = new Stack<>();
boolean opening = false;
boolean closing = false;
@sz332
sz332 / Dockerfile
Last active April 10, 2023 12:35
Greenmail and Thunderbird
FROM openjdk:8-jre-alpine AS base
ENV GREENMAIL_OPTS -Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.smtp.hostname=localhost -Dgreenmail.verbose
RUN apk add --no-cache curl
RUN curl -O http://central.maven.org/maven2/com/icegreen/greenmail-standalone/1.5.9/greenmail-standalone-1.5.9.jar
FROM openjdk:8-jre-alpine AS final
@sz332
sz332 / index.js
Last active August 29, 2019 07:53
Working example of bull and external processor
// index.js
const path = require('path');
const Queue = require('bull');
let queue = new Queue('test queue', 'redis://192.168.99.100:6379');
queue.process(1, path.join(__dirname, './processor.js'))
queue.on('completed', function(job, result) {
console.log("Completed: " + job.id + ", result = " + JSON.stringify(result));
List<Integer> l = Arrays.asList(new Integer[]{1,2,3});
Integer min = l.stream().min(Integer::compare).get();
@sz332
sz332 / customelement.html
Created February 21, 2018 14:45
Custom element
<html>
<head>
<script>
class HelloWorld extends HTMLElement {
constructor() {
super();
let shadowRoot = this.attachShadow({
mode: 'open'