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 / 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 / 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 / download-batch-for-linux.sh
Last active November 27, 2017 21:45
Batch script to download Youtube videos from a listing file (one video per line)
#!/bin/bash
# Configuration
DL_DIR="/wherever/you/want"
INPUT="/wherever/is/your/file"
# We need "youtube-dl" (https://github.com/rg3/youtube-dl).
# We here download the best video quality.
# One Youtube address per line. Empty lines are ignored.
mkdir -p $DL_DIR && cd $DL_DIR
@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 / 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 / reminder-about-tcpmon.sh
Created November 21, 2019 18:09
A short reminder about how to use TCPmon to capture traffic
#!/bin/sh
# Assuming we have an Elastic Search cluster secured by Nginx.
#################
# On the server.
#################
# Capture HTTP traffic to Nginx (listening on port 9200).
# Output the result in a PCAP file, readable with Wireshark.
@vincent-zurczak
vincent-zurczak / reminder-about-ova.sh
Created November 21, 2019 18:17
A quick reminder about how to prepare a VMWare (OVF) export to Openstack
#!/bin/sh
# Let's assume you have an OVF image exported from VMWare
# (the *.ovf descriptor, *.vmdk, *.mf and *.nvram files)
# that you want to deploy on Openstack.
# An OVA file is a TAR archive that wraps all this file structure.
BASE_NAME="sample"
tar -cf "${BASE_NAME}.ova" "${BASE_NAME}.ovf" "${BASE_NAME}.mf" "${BASE_NAME}-1.vmdk"