Skip to content

Instantly share code, notes, and snippets.

View tdomzal's full-sized avatar

Tomasz Domżał tdomzal

View GitHub Profile
@tdomzal
tdomzal / RestConfiguration.java
Created October 20, 2018 16:26 — forked from ripla/RestConfiguration.java
The different ways of accessing a REST HATEOAS resource created with Spring Data. Using a Spring RestTemplate.
import java.util.Arrays;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.hal.Jackson2HalModule;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
@tdomzal
tdomzal / docker_snippets.sh
Last active July 18, 2016 12:32
Docker snippets
#!/bin/bash
# remove dangling images
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi
# list container ids created from specified image
docker ps -a -f "ancestor=nginx:latest" --format "{{.ID}}"
docker rmi $(docker images -q -f dangling=true)
@tdomzal
tdomzal / setdock.cmd
Last active December 9, 2015 10:46
Windows cmd shell for updating docker variables with option to set on system level.
@ECHO OFF
setlocal EnableDelayedExpansion
if "%1"=="/s" (
set system=true
shift /1
)
:execute
if "%1"=="" goto usage
FOR /f "tokens=*" %%i IN ('docker-machine env --shell cmd %1') DO %%i
@tdomzal
tdomzal / standalone.conf.part.bat
Created September 28, 2015 09:10
JBoss 7.2 JVM GC Opts
rem # GC log
set "datetime=%date% %time%"
rem # correction for one digit hour
if "%datetime:~11,1%" == " " (set datetime=%datetime:~0,10% 0%datetime:~12,7%)
set "GC_LOG_FILE=verbosegc-%datetime:~0,4%%datetime:~5,2%%datetime:~8,2%-%datetime:~11,2%%datetime:~14,2%.log"
set "GC_OPTS=-verbose:gc -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:-UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=1024K -Xloggc:%JBOSS_HOME%\standalone\log\%GC_LOG_FILE%"
set "JAVA_OPTS=%JAVA_OPTS% %GC_OPTS%"
@tdomzal
tdomzal / ParallelSeleniumTestBase.java
Last active March 11, 2020 08:23
Parallel Selenium example
package example.junit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@tdomzal
tdomzal / java-install-cert.sh
Last active August 29, 2015 14:23
Bash script to download InstallCert.jar tool and add https certificate into ${JAVA_HOME}/jre/lib/security
#!/bin/bash
echoerr() { echo "$@" 1>&2; }
if [ $# -ne 1 ]; then
echo "Illegal number of parameters"
echo "Usage: "
echo " $0 <hostname:port>"
exit 1
fi
@tdomzal
tdomzal / .bash_profile
Last active August 29, 2015 14:21
git enabled bash prompt setup
#!/bin/bash
# git prompt inspired by:
# http://neverstopbuilding.com/gitpro
# colors help:
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
if [ "$1" == "install" ] ; then
WGET_PATH=$(which wget)
if [ ! -x "$WGET_PATH" ] ; then