Skip to content

Instantly share code, notes, and snippets.

Josef Cacek kwart

View GitHub Profile
@kwart
kwart / github-team.py
Last active Oct 17, 2018 — forked from krues8dr/github-team.py
Python script to add all GitHub repositories to an organization team - permission is set to push. You'll need a settings.py file with your organization name and API key. Based off of my GitHub stats script (requirements.txt here): https://github.com/krues8dr/project-migration
View github-team.py
#!/usr/bin/python
# Exports a CSV of repo names, readme files, and the license of the project.
from __future__ import print_function
import requests
import json
import settings
from urlparse import urlparse, parse_qs
import sys
@kwart
kwart / ConfigureMemberLoginModule.java
Created Feb 9, 2018
Create Hazelcast configuration with custom login module
View ConfigureMemberLoginModule.java
LoginModuleConfig loginModuleConfig = new LoginModuleConfig();
loginModuleConfig.setClassName(CustomVerifyingLoginModule.class.getName());
loginModuleConfig.setUsage(LoginModuleUsage.REQUIRED);
Properties properties = new Properties();
properties.setProperty("allowed-hosts", "192.168.2.*,server-x.my-company.example")
loginModuleConfig.setProperties(properties);
config.getSecurityConfig().setEnabled(true).addMemberLoginModuleConfig(loginModuleConfig);
@kwart
kwart / VerifyRemoteAddressInterceptor.java
Created Feb 9, 2018
Validating remote address in Hazelcast. We don't have information if the other side is member or client yet.
View VerifyRemoteAddressInterceptor.java
/*
// Usage:
Config config = new Config();
SocketInterceptorConfig socketInterceptorConfig = new SocketInterceptorConfig();
VerifyRemoteAddressInterceptor interceptor = new
VerifyRemoteAddressInterceptor();
socketInterceptorConfig.setImplementation(interceptor).setEnabled(true);
config.getNetworkConfig().setSocketInterceptorConfig(socketInterceptorConfig);
Hazelcast.newHazelcastInstance(config);
*/
@kwart
kwart / limit-time.sh
Last active Jan 28, 2018
Dialog based script which shuts down the machine after given amount of time.
View limit-time.sh
if timeoutMin=$(zenity --entry --text "Shutdown in (min)" --entry-text "30" --title "Shutdown?"); then
sudo shutdown -P ${timeoutMin}
fi
View SecurityInterceptorTest.java
/*
* Copyright (c) 2008-2017, Hazelcast, Inc. 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
@kwart
kwart / standalone-EXTERNAL-DR19.xml
Created May 26, 2017
Wildfly - EXTERNAL SASL mechanism configured in Elytron
View standalone-EXTERNAL-DR19.xml
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:5.0">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
@kwart
kwart / elytron-ssl.cli
Created May 17, 2017
WildFly Elytron - Full SSL with fallback (Client Cert authentication with fallback to username / password authentication.)
View elytron-ssl.cli
# Paths
./path=elytron.project:add(path=/home/darranl/src/wildfly10/wildfly-elytron)
./path=elytron.project.jks:add(path=src/test/resources/ca/jks, relative-to=elytron.project)
./path=elytron.project.properties:add(path=src/test/resources/org/wildfly/security/auth/realm, relative-to=elytron.project)
# KeyStores
./subsystem=elytron/key-store=localhost:add(type=jks, relative-to=elytron.project.jks, path=localhost.keystore, credential-reference={clear-text=Elytron})
./subsystem=elytron/key-store=beetles:add(type=jks, relative-to=elytron.project.jks, path=beetles.keystore, credential-reference={clear-text=Elytron})
@kwart
kwart / SaslFactoriesApiTest.java
Created Nov 23, 2016
Black-box testing of SASL factories implementations (Elytron)
View SaslFactoriesApiTest.java
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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
View Version.java
package cz.cacek.javlog.Version;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* This class represents a (number-based) version. It allows to compare the versions. Find the comparison algorithm details in
* {@link #compareTo(Version)} description.
*
@kwart
kwart / server.log
Created Jul 1, 2016
Issue hit on MS Azure
View server.log
2016-07-01 16:25:42,767 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final-redhat-1
2016-07-01 16:25:53,115 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final-redhat-1
2016-07-01 16:25:53,845 INFO [org.jboss.as] (MSC service thread 1-1) WFLYSRV0049: JBoss EAP 7.0.0.GA (WildFly Core 2.1.3.Final-redhat-1) starting
2016-07-01 16:25:53,883 DEBUG [org.jboss.as.config] (MSC service thread 1-1) Configured system properties:
[Standalone] =
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
You can’t perform that action at this time.