Skip to content

Instantly share code, notes, and snippets.

@paulbrodner
paulbrodner / get-random-from-array.java
Created December 14, 2018 18:54
return random value from array
private static List<String> KEYS = Arrays.asList(
"customer.1",
"customer.2",
"customer.4",
"customer.4"
);
private Random random = new Random();
private String randomKey() {
@paulbrodner
paulbrodner / multiple-java-versions.sh
Last active December 16, 2018 12:20
two java versions on same machine OSX
# this script has two steps
# a) installing the new Java version
# b) preparing your ~/.bash_profile with a switch flag between java versions
# a) installing the new Java version
# I assume you have
# * brew installed on your Mac OS https://brew.sh/
# * https://github.com/Homebrew/homebrew-cask -> $ brew tap homebrew/cask-versions
# * eclipse updated https://marketplace.eclipse.org/content/java-11-support-eclipse-2018-09-49
@paulbrodner
paulbrodner / docker-env-clean.sh
Created December 6, 2018 13:08
clean environment of all containers removing dangling volumes as well
# stop all containers
docker kill $(docker ps -q)
# kill all dangling volumes
docker volume ls -qf dangling=true | xargs -r docker volume rm
@paulbrodner
paulbrodner / fingerprint.sh
Created November 19, 2018 13:53
id_rsa fingerprint
openssl rsa -in ~/ssh/id_rsa -pubout -outform DER | openssl md5 -c
@paulbrodner
paulbrodner / clean-charts.sh
Last active December 6, 2018 13:03
delete-all-helm-charts
CHART_REPO=http://chartmuseum.my.repo.me
CHART_CRED=admin:admin
curl $CHART_REPO/api/charts | jq
for i in {1..5}
do
curl -X DELETE -u $CHART_CREDS $CHART_REPO/api/charts/tcds/0.0.$i
done
@paulbrodner
paulbrodner / download-maven-artifact.sh
Created September 14, 2018 08:54
download maven artifact
mvn com.googlecode.maven-download-plugin:download-maven-plugin:1.4.1:artifact -DgroupId=com.googlecode -DartifactId=maven-download-plugin -Dversion=0.1 -DoutputDirectory=temp
See: https://github.com/maven-download-plugin/maven-download-plugin
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.paulbrodner</groupId>
<artifactId>my-dummy-pom</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
=IF(COUNTIF(Inventory!A$2:A$229,A1),"Yes","No")
check if value from A1 exist in range: Inventory!A$2:A$229
find . -name "*.jar" -type f -printf "%f\n" |sort | uniq -c > jars.txt
#count
find . -name "*.jar" -type f -printf "%f\n" |sort | uniq -c | wc -l >> jars.txt
echo "starting whitesource scan with File System Agent"
#https://whitesource.atlassian.net/wiki/spaces/WD/pages/33718339/File+System+Agent#FileSystemAgent-Prerequisites
# download first https://s3.amazonaws.com/file-system-agent/whitesource-fs-agent-18.6.3.jar
java -jar whitesource-fs-agent-18.6.3.jar -apiKey $WHITESOURCE_API_KEY -d packaging/target/alfresco-search-services