Skip to content

Instantly share code, notes, and snippets.

Avatar

Pierluigi Vernetto vernetto

View GitHub Profile
@vernetto
vernetto / audit.sh
Created Aug 11, 2019
check for added files or folders
View audit.sh
function contains() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo "y"
return 0
fi
}
echo "n"
View MockitoAnnotationTest.java
package org.pierre.mockito;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.*;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@vernetto
vernetto / bashtutorial.txt
Last active Apr 14, 2019
bashtutorial.txt
View bashtutorial.txt
References:
https://ryanstutorials.net/bash-scripting-tutorial/ Bash tutorial
https://ryanstutorials.net/linuxtutorial/ Linux tutorial
http://tldp.org/LDP/abs/html/string-manipulation.html string manipulation in bash
View gist:283abc56a725c003e7422a8a3f67c744
package org.pierre.streams;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.FileReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
View gist:970665371b0ab556dcc16be60d3861e3
package org.pierre.java11tests;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringJoiner;
public class ProcessTest {
public static void main(String[] args) throws IOException {
ProcessBuilder pb = new ProcessBuilder("cmd","/C", "dir d:\\temp");
@vernetto
vernetto / gist:a6c144fc01242978b174b2fecdae526b
Created Dec 20, 2018
Nexus Swagger code to search components etc
View gist:a6c144fc01242978b174b2fecdae526b
package com.juliusbaer.nexus.nexusswaggerclient;
import java.util.List;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiException;
import io.swagger.client.api.AssetsApi;
import io.swagger.client.api.ComponentsApi;
import io.swagger.client.api.SearchApi;
import io.swagger.client.model.AssetXO;
View gist:8d33fac76433e1aae4a7ee461b92d3aa
https://github.com/sass/node-sass/issues/2455
[centos@localhost bin]$ find / -name node-sass 2> /dev/null
/home/centos/.npm/registry.npmjs.org/node-sass
/home/centos/.npm/node-sass
/home/centos/node-v0.10.30/node_modules/node-sass
/home/centos/node-v0.10.30/node_modules/node-sass/bin/node-sass
/home/centos/node-v0.10.30/node_modules/.bin/node-sass
/home/centos/node_modules/.bin/node-sass
/home/centos/node_modules/node-sass
View gist:d85c8e96437a4e7236af011d11384904
System.out.println("parsing JSON file ");
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("bikes.json").getFile());
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(file);
System.out.println(jsonNode);
Properties props = new Properties();
props.setProperty("resource.loader", "file");
//props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
@vernetto
vernetto / pom.xml
Last active Dec 5, 2017
sample pom for javaee
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pierre</groupId>
<artifactId>pvabwebsockets</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
@vernetto
vernetto / pom.xml
Created Dec 2, 2017
pom.xml netbeans primefaces
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>AnApp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>AnApp</name>