Skip to content

Instantly share code, notes, and snippets.

View ghusta's full-sized avatar

Guillaume Husta ghusta

  • Toulouse, France
  • 21:11 (UTC +01:00)
  • X @ghusta
View GitHub Profile
ghusta /
Created October 5, 2022 21:31
Testing Java regex with SemVer example (named capturing group)
import org.junit.jupiter.api.Test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static;
class MyRegexTest {
ghusta / Vagrantfile
Last active April 20, 2021 16:28
Vagrant : Ubuntu 20.04 / Hyper-V
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
ghusta / test.jsp
Created January 2, 2019 11:08
Change the HTTP response status for a JSP
View test.jsp
<%@ page language="java" contentType="text/html; UTF-8; charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
<!DOCTYPE html>
<html lang="en">
ghusta /
Created October 24, 2018 07:05
Spring custom meta-annotation with redeclared attributes from meta-annotations
import org.springframework.core.annotation.AliasFor;
import org.springframework.transaction.annotation.Transactional;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
* Meta-annotation Spring.
ghusta / Dockerfile
Last active November 14, 2018 09:20
Docker image Postgres with vi(m)
View Dockerfile
FROM postgres:latest
RUN apt-get update && \
apt-get install -y vim
ghusta /
Created June 26, 2018 13:50
Build Docker CLI for Windows (docker.exe)
git clone
# List all tags (exclude the rc)
git tag --list 'v*-ce'
# Checkout desired version (tag)
git checkout 18.05.0-ce
# Build docker.exe CLI for Windows
cd components/cli
ghusta / index.jsp
Created May 2, 2018 12:26
JSP redirection preserving parameters
View index.jsp
<%@ page contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="c" uri="" %>
<c:redirect url="/login.jsp">
<c:forEach items="${param}" var="entry">
<c:param name="${entry.key}" value="${entry.value}" />
ghusta / create_machine_docker-dev.cmd
Created January 17, 2018 15:20
Create a Docker Machine with Windows, VirtualBox and Boot2Docker with a customized shared folder
View create_machine_docker-dev.cmd
rem set MACHINE_STORAGE_PATH=D:\Dev\Docker\.docker\machine
docker-machine version
docker-machine ls
echo creation VM VirtualBox : Docker Machine (Help : docker-machine create --help)
rem var env (ex : proxy) : --engine-env
set VM_NAME=docker-dev
mkdir d:\Dev\Docker\.docker\machine\SharedFolders\%VM_NAME%
docker-machine create -d "virtualbox" --virtualbox-cpu-count "2" --virtualbox-disk-size "50000" --virtualbox-memory "2048" --virtualbox-share-folder "\\?\d:\Dev\Docker\.docker\machine\SharedFolders\%VM_NAME%:host-shared" %VM_NAME%
ghusta /
Created October 25, 2017 15:23
ObjectMapper specificObjectMapper = new ObjectMapper();
specificObjectMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
specificObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ghusta /
Created June 29, 2017 11:09
Joda Time DateTime formatted according to Locale
import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.junit.Before;
import org.junit.Test;
import java.util.Locale;