Skip to content

Instantly share code, notes, and snippets.

Avatar

Josef Cacek kwart

View GitHub Profile
View hazelcast-kill-2-out-of-7-docker.sh
#!/bin/bash
# define Hazelcast configuration in YAML file (TCP discovery used, REST API enabled)
cat <<EOT >hazelcast.yaml
hazelcast:
network:
join:
multicast:
enabled: false
tcp-ip:
@kwart
kwart / shotTheScreen.sh
Last active Sep 23, 2019
LInux - take the screenshot every 30 seconds
View shotTheScreen.sh
#!/bin/bash
while scrot '/tmp/scr-%Y%m%d-%H%M%S.png' -q 20; do
sleep 30
done
View gist:3d707fbc7c9f0776e587f8fad67eccd6
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
@kwart
kwart / github-team.py
Last active Oct 17, 2018 — forked from krusynth/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})
You can’t perform that action at this time.