Skip to content

Instantly share code, notes, and snippets.

@javajack
javajack / example.cs
Created January 31, 2022 18:57 — forked from brandonmwest/example.cs
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
public List<ProfileDocument> searchByTechnology(String technology) throws Exception {
SearchRequest searchRequest = new SearchRequest();
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
QueryBuilder queryBuilder = QueryBuilders
.boolQuery()
.must(QueryBuilders
.matchQuery("technologies.name", technology));
@javajack
javajack / remove-all-from-docker.sh
Created August 22, 2019 11:26 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@javajack
javajack / Dockerfile
Last active April 16, 2023 12:33 — forked from jakubigla/Dockerfile
Dockerfile for multistage build of spring boot application using maven with SonarQube and proxy support https://blog.pavelsklenar.com/spring-boot-run-and-build-in-docker/
### BUILD image
FROM maven:3-jdk-11 as builder
#Copy Custom Maven settings
#COPY settings.xml /root/.m2/
# create app folder for sources
RUN mkdir -p /build
WORKDIR /build
COPY pom.xml /build
#Download all required dependencies into one layer
RUN mvn -B dependency:resolve dependency:resolve-plugins
@javajack
javajack / JsonBinder.java
Created June 26, 2018 07:59 — forked from schaloner/JsonBinder.java
Supporting PostgreSQL JSON types in jOOQ using Jackson. Adapted from the GSON example found at https://www.jooq.org/doc/3.9/manual/code-generation/custom-data-type-bindings/
package be.objectify.example.jooq;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Types;
import java.util.Objects;
import com.fasterxml.jackson.databind.JsonNode;
import org.jooq.Binding;
import org.jooq.BindingGetResultSetContext;
import org.jooq.BindingGetSQLInputContext;
@javajack
javajack / sec_tutorial.md
Created April 12, 2016 05:10 — forked from tgrall/sec_tutorial.md
MongoDB Security Tutorial

#Simple MongoDB Security Tutorial

###1 - Start mongod without any "security option"

$ mongod --port 27017

@javajack
javajack / gist:04422d5a95d8e8dae1aa
Last active May 11, 2022 18:03 — forked from eogiles/gist:5718170
SOAP JAX WS Password Digest Nonce Date Created Handler generator
package sample;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@javajack
javajack / gist:da3c65f4f37f1ed78bf7
Last active July 6, 2017 19:42 — forked from carloprad/gist:10dbfbeea3be120d348d
wsse usernametoken password digest soap generator
import org.apache.ws.security.WSConstants;
import org.apache.ws.security.message.WSSecHeader;
import org.apache.ws.security.message.WSSecUsernameToken;
import org.apache.ws.security.WSSConfig;
import org.apache.xalan.processor.TransformerFactoryImpl;
import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.transform.OutputKeys;
@javajack
javajack / A_maven.md
Created October 1, 2015 12:09 — forked from ashrithr/A_maven.md
build java projects using maven

Intro to Maven

###Create a project from Maven Template:

To start a new maven project, use the maven archetype plugin from the command line using the archetype:generate goal.

The following command will tell maven to create a java project from maven-archetype-quickstart template, if you ignore the archetypeArtifactId argument, then a list of the templates will be listed for you to choose.

@javajack
javajack / DatabasesConfig.java
Last active September 9, 2015 08:23 — forked from mismatch/DatabasesConfig.java
Spring Boot. Multiple datasources configuration example
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;