Skip to content

Instantly share code, notes, and snippets.

View stillalex's full-sized avatar

Alex D stillalex

View GitHub Profile
@stillalex
stillalex / JSCHWrapper.java
Created February 11, 2011 17:55
Short version of classes used in a blog post - full version at https://github.com/alexparvulescu/blog/blob/master/remote-java-install
public class JSCHWrapper {
// just pass private key, user and host
public JSCHWrapper(String identityFile, String user, String host){ /* .. */ }
// executes a command
public String execCommand(String command) throws Exception { /* .. */ }
// disconnects the current ssh session
public void disconnect() { /* .. */ }
@stillalex
stillalex / VersionTweakTest
Created March 6, 2012 09:43
Jackrabbit Version tweaking
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@stillalex
stillalex / DiffMvnTest.scala
Last active December 13, 2015 18:59
Utility class that diffs 2 maven test run logs and outputs the percentage difference in the run times on test classes that are found in both files
import scala.Option.option2Iterable
import scala.io.Source
/**
* Utility class that diffs 2 maven test run logs and outputs the percentage difference in the run times on test classes that are found in both files
*
* How to run
*
* - run first test on the reference
* mvn clean install > before.log
@stillalex
stillalex / uuidTest
Created June 27, 2014 15:21
uuid generation for a new node of type file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicInteger
import org.apache.jackrabbit.oak.api.Type
import org.apache.jackrabbit.oak.plugins.segment.SegmentBlob
import org.apache.jackrabbit.oak.spi.state.NodeState
def countNodes(NodeState n, deep = false, String path = "/", Integer flush = 50000, AtomicInteger count = new AtomicInteger(0), AtomicInteger binaries = new AtomicInteger(0), root = true) {
if(root) {
println "Counting nodes in tree ${path}"
}
@stillalex
stillalex / gist:08046743cc8532a9192f
Created September 16, 2014 13:40
Run luke with Oak Lucene Codec
// Oak Lucene Codec is exported at
// https://github.com/alexparvulescu/oak-lucene-codec
git clone https://github.com/alexparvulescu/oak-lucene-codec
// Luke Lucene explorer is cloned at
// https://github.com/alexparvulescu/luke
git clone https://github.com/alexparvulescu/luke
// build projects and run:
java -XX:MaxPermSize=512m -cp luke/target/luke-with-deps.jar:oak-lucene-codec/target/oak-lucene-codec-1.1-SNAPSHOT.jar org.getopt.luke.Luke
@stillalex
stillalex / subsystem
Created October 9, 2014 13:14
subsystem osgi bundle urls list
http://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
http://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-simple/1.7.7/slf4j-simple-1.7.7.jar
http://search.maven.org/remotecontent?filepath=org/apache/aries/org.apache.aries.util/1.1.0/org.apache.aries.util-1.1.0.jar
http://search.maven.org/remotecontent?filepath=org/apache/aries/subsystem/org.apache.aries.subsystem.api/1.0.0/org.apache.aries.subsystem.api-1.0.0.jar
http://search.maven.org/remotecontent?filepath=org/eclipse/equinox/org.eclipse.equinox.region/1.1.0.v20120522-1841/org.eclipse.equinox.region-1.1.0.v20120522-1841.jar
http://search.maven.org/remotecontent?filepath=org/apache/felix/org.apache.felix.coordinator/1.0.0/org.apache.felix.coordinator-1.0.0.jar
http://search.maven.org/remotecontent?filepath=org/apache/felix/org.apache.felix.resolver/1.0.0/org.apache.felix.resolver-1.0.0.jar
http://search.maven.org/remotecontent?filepath=org/apache/aries/subsystem/org.apache.aries.subsystem.core/1.1.0/org.apa
@stillalex
stillalex / rmNode.groovy
Created November 21, 2014 19:16
Groovy script to remove a node at a given path
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.apache.jackrabbit.oak.commons.PathUtils
def rmNode(def session, String path) {
println "Removing node ${path}"
NodeStore ns = session.store
def nb = ns.root.builder()
@stillalex
stillalex / CustomIndexInitializer.java
Created June 5, 2015 18:48
RepositoryInitializer for disabling a given index
import static com.google.common.collect.Sets.newHashSet;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
import java.util.Set;
import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@stillalex
stillalex / logging.md
Last active March 12, 2022 15:33
TarMk Cold Standby Logging

TarMk Cold Standby Logging Tips

StandbyClientHandler

Enable DEBUG logs on org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClientHandler

This will only log the start and the end of the sync cycle, no progress indication logged.

You'll get the following: