Skip to content

Instantly share code, notes, and snippets.

View dsmiley's full-sized avatar

David Smiley dsmiley

View GitHub Profile
@dsmiley
dsmiley / gist:2583730
Created May 3, 2012 06:20 — forked from philk/gist:1238525
jconsole via socks proxy
function jc_remote {
jmx_host=$1
jmx_port=${2:-5000}
proxy_port=${3:-8123}
echo "Connecting jconsole to $jmx_host:$jmx_port via SOCKS proxy using local port $proxy_port"
ssh -ND $proxy_port $jmx_host &
jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=${proxy_port} \
service:jmx:rmi:///jndi/rmi://localhost:${jmx_port}/jmxrmi
kill %1
@dsmiley
dsmiley / gist:4c5d316707cf05e2cb82
Last active August 29, 2015 14:05 — forked from michalbcz/gist:3916997
Embedding groovy Console
def c = new groovy.ui.Console(getClass().classLoader, new Binding(project:project))
c.run()
def doneLatch = new java.util.concurrent.CountDownLatch(1)
c.frame.windowClosed = {doneLatch.countDown()}
doneLatch.await()
<!-- this is a part of Solr's jetty.xml to access control for some IPs -->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
@dsmiley
dsmiley / TTY to pass signals
Last active January 14, 2020 14:16
Rsync and SSH to remote host
#!/bin/sh
#
# Utility script to rsync and then open a shell or execute commands on a remote host.
# Tailored a little bit for Lucene/Solr
# @author David Smiley
#
set -uex
REMOTEHOST=buildbox.local
REMOTEPATH="builds$PWD"
class SettableBreakIterator extends BreakIterator {
private final BreakIterator delegate;
private int currentCache;
public SettableBreakIterator(BreakIterator delegate) {
this.delegate = delegate;
currentCache = delegate.current();
}
@dsmiley
dsmiley / buildbox.sh
Created May 19, 2020 15:38
buildbox similar to crave
#!/bin/sh
#
# Utility script to rsync and then open a shell or execute commands on a remote host.
# Tailored a little bit for Lucene/Solr
# @author David Smiley
# https://gist.github.com/dsmiley/daff3c978fe234b48a69a01b54ea9914
set -uex
REMOTEHOST=buildbox
REMOTEPATH="builds$PWD"
@dsmiley
dsmiley / parseContributorsFromChanges.py
Created April 26, 2024 05:32
Lucene/Solr: Parse contributors from our CHANGES.txt for easy sharing / tabulation.
import re
from collections import defaultdict
data = """
================== 9.6.0 ==================
New Features
---------------------
* SOLR-17141: Implement 'cpuAllowed' query parameter to limit the maximum CPU usage by a running query. (Andrzej Bialecki, Gus Heck, David Smiley)
* SOLR-599: Add a new SolrJ client using the JDK’s built-in Http Client. (James Dyer)
@dsmiley
dsmiley / ZkArchUnitTest.java
Created May 28, 2024 06:18
ArchUnit dependency rule Zk and Netty
package org.apache.zookeeper;
import static com.tngtech.archunit.core.importer.ImportOption.Predefined.DO_NOT_INCLUDE_TESTS;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
import com.tngtech.archunit.base.DescribedPredicate;
import com.tngtech.archunit.core.domain.JavaClass;
import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.core.importer.ImportOption;