Skip to content

Instantly share code, notes, and snippets.

View peterkir's full-sized avatar

Peter Kirschner peterkir

View GitHub Profile
#!/usr/bin/env jjs
function runTest() {
var URL = Packages.java.net.URL;
var LinkedHashSet = Packages.java.util.LinkedHashSet;
set = new LinkedHashSet();
set.add(new URL("http://Square.GitHub.io/"));
set.add(new URL("http://square.github.io:80/"));
set.add(new URL("http://google.github.io/"));
size = set.size();
if (size === 2) {
@peterkir
peterkir / CanonicalURLs.java
Last active April 18, 2016 05:22
java.net.URL obstacles with URL.equals
package issue.java.net.url;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedHashSet;
import java.util.Set;
public class CanonicalURLs {
public static void main(String[] args) {
@peterkir
peterkir / TestJunction.java
Last active January 5, 2017 16:18
TestJunctionWithJavaNIO
package test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
/*
@peterkir
peterkir / bnd_macro_know-how.bnd
Last active April 24, 2018 18:09
bnd - Macro and Instruction examples
# replace examples
# replace backslash with slash
project.unix = ${replace;${project};(\\\\);/}
DEBUG_X = ${subst;${basename;${thisfile}};\.bnd$;;1}
DEBUG_BASENAME = ${basename;${thisfile}}
# replace . with _
Wrapped-Jar-Version=3.12.0
@peterkir
peterkir / io.klib.bintray.Delete.java
Created December 4, 2015 10:38
Deleting via JFrog Bintray REST API
package io.klib.bintray;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
@peterkir
peterkir / AppendToFile.java
Last active April 15, 2016 07:04
Java - parse log file, extract filelist and append to each file something
package io.klib.tools.files;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@peterkir
peterkir / p2.publisher.FeaturesAndBundlesPublisher.cmd
Last active April 18, 2016 05:59
Publish a p2 repo from existing features and plugins (including valid md5 and artifacts sizes) - IGNORING binary artefacts
:: Publish an existing p2 repo with proper sizes for artifact and download and md5 checksums
SET ECLIPSE_SDK=c:\apps\eclipse-SDK-4.5.2-win32-x86_64\
SET EQUINOX_LAUNCHER_VERSION=1.3.100.v20150511-1540
SET REPO_SOURCE=C:/__publisher/exportIDE
SET REPO_TARGET=C:/__publisher/exportPublished
java -jar %ECLIPSE_SDK%\eclipse\plugins\org.eclipse.equinox.launcher_%EQUINOX_LAUNCHER_VERSION%.jar ^
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher ^
@peterkir
peterkir / p2-process-artifcats.xml
Last active May 24, 2022 18:28
ANT task for p2.process.artifacts - adding md5 and artifacts sizes to p2 repository
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="p2-process-artifcats">
<property name="p2.repo" value="file:///C:/tmp/161.1.9.RC0-20160407-200004" />
<target name="p2-process-artifcats" description="adds md5 and artifacts sizes to p2 repository">
<p2.process.artifacts repositorypath="${p2.repo}" />
</target>
</project>
@peterkir
peterkir / gogo.sh
Created February 6, 2017 11:47
OSGi gogo shell examples
# Gogo Shell Command - inspect
help inspect
# inspect - inspects bundle capabilities and requirements
# scope: felix
# parameters:
# String ('capability' | 'requirement')
# String (<namespace> | 'service')
# Bundle[] target bundles
@peterkir
peterkir / bindex.cmd
Created February 6, 2017 11:59
Example of cmd line bindex call
#java -jar C:\tmp\BNDarchive\archive\dist\bundles\biz\aQute\bnd\org.osgi.impl.bundle.repoindex.cli\3.4.0-SNAPSHOT\org.osgi.impl.bundle.repoindex.cli-3.4.0-20161003.182247-1.jar ^
#-d C:/jbe5.0.2/repo/download.eclipse.org/eclipse/updates/4.6/R-4.6.1-201609071200 ^
#-n "Eclipse Platform R-4.6.1-201609071200" ^
#-v C:/jbe5.0.2/repo/download.eclipse.org/eclipse/updates/4.6/R-4.6.1-201609071200
java -jar C:\tmp\BNDarchive\archive\dist\bundles\biz\aQute\bnd\org.osgi.impl.bundle.repoindex.cli\3.4.0-SNAPSHOT\org.osgi.impl.bundle.repoindex.cli-3.4.0-20161003.182247-1.jar ^
-d C:/jbe5.0.2/repo/download.eclipse.org/releases/neon/201609281000 ^
-n "Eclipse Simultaneous Release 201609281000" ^
-v C:/jbe5.0.2/repo/download.eclipse.org/releases/neon/201609281000