Skip to content

Instantly share code, notes, and snippets.

View vincent-zurczak's full-sized avatar

Vincent Zurczak vincent-zurczak

View GitHub Profile
@vincent-zurczak
vincent-zurczak / Main.java
Created April 25, 2014 17:16
Convert a WSDL to its XMI Representation
public static void main( String[] args ) {
/*
* Manifest Dependencies used for this example.
*
* org.eclipse.emf,
* org.eclipse.emf.common,
* org.eclipse.emf.ecore,
* org.eclipse.emf.ecore.edit,
* org.eclipse.emf.ecore.xmi,
@vincent-zurczak
vincent-zurczak / Validator.java
Last active September 26, 2021 18:50
HTML 5 validation in Java (based on the Nu HTML Checker)
/**
* Verifies that a HTML content is valid.
* @param htmlContent the HTML content
* @return true if it is valid, false otherwise
* @throws Exception
*/
public boolean validateHtml( String htmlContent ) throws Exception {
InputStream in = new ByteArrayInputStream( htmlContent.getBytes( "UTF-8" ));
ByteArrayOutputStream out = new ByteArrayOutputStream();
@vincent-zurczak
vincent-zurczak / create-snapshots.sh
Created March 16, 2015 09:08
Create video snapshots with VLC in batch mode
#!/bin/bash
ROOT=/data/test
for f in $ROOT/my_dir/*.mkv
do
# Display progress information
echo "Processing $f..."
date
# Remove the file extension (here, .mkv)
@vincent-zurczak
vincent-zurczak / gulpfile.js
Last active August 29, 2015 14:21
Copy Bower dependencies with Gulp
// Include our plug-ins
var gulp = require('gulp');
var bowerMain = require('bower-main');
var mainBowerFiles = require('main-bower-files');
var exists = require('path-exists').sync;
var gulpIgnore = require('gulp-ignore');
// Create some task
gulp.task( 'copy-bower-dep', function() {
@vincent-zurczak
vincent-zurczak / gulpfile.js
Last active November 20, 2018 13:07
Copy minified Bower dependencies with Gulp (better solution)
// Include our plug-ins
var gulp = require('gulp');
var mainBowerFiles = require('main-bower-files');
var exists = require('path-exists').sync;
// Create some task
gulp.task( 'copy-bower-dep', function() {
// Replace files by their minified version when possible
var bowerWithMin = mainBowerFiles().map( function(path, index, arr) {
@vincent-zurczak
vincent-zurczak / ReactorDependenciesResolverMojoTest.java
Last active September 8, 2018 01:45
A Maven mojo that shows how to resolve dependencies locations, be it in remote or in the local repository, or even in the reactor.
package whatever;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
@vincent-zurczak
vincent-zurczak / winrar-pwd-checker.bat
Created May 16, 2016 12:52
A MS-DOS script to try various passwords for RAR archives
:: The password candidates.
:: FIXME: read them from a file.
set list="pwd1" "pwd2" "pwd3" "pwd4"
:: Assumption: there is only one RAR file in the directory.
:: FIXME: iterate over a list of files?
:: The script stops as soon as an extraction succeeds.
FOR %%A IN (%list%) DO (
echo "Testing %%A..."
@vincent-zurczak
vincent-zurczak / DelayedInstallationOfTargetHandlerTest.java
Created June 3, 2016 07:02
Execute Karaf Commands in PAX-Exam Tests
package whatever;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.PrintStream;
import java.security.PrivilegedActionException;
@vincent-zurczak
vincent-zurczak / JSonBindingUtils.java
Created August 24, 2016 18:26
Generating swagger.json files with Enunciate and custom objects mappers
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
@vincent-zurczak
vincent-zurczak / Dockerfile
Created March 21, 2017 19:40
Create a Docker container with both kubectl and helm
# Based on https://github.com/wernight/docker-kubectl
# Both kubectl and helm are available when we launch the image (docker run -ti this-image).
# The best option would be mounting the ".kube/config" file as a volume.
FROM wernight/kubectl:1.5.3
# Install Helm
USER root
RUN cd /home \
&& curl https://storage.googleapis.com/kubernetes-helm/helm-v2.2.3-linux-amd64.tar.gz -o helm.tar.gz \
&& tar -xvf helm.tar.gz \