Skip to content

Instantly share code, notes, and snippets.

View stalep's full-sized avatar

Ståle Pedersen stalep

  • Red Hat
  • Arendal, Norway
View GitHub Profile
import org.jboss.aesh.cl.CommandDefinition;
import org.jboss.aesh.cl.GroupCommandDefinition;
import org.jboss.aesh.cl.Option;
import org.jboss.aesh.console.AeshConsole;
import org.jboss.aesh.console.AeshConsoleBuilder;
import org.jboss.aesh.console.Prompt;
import org.jboss.aesh.console.command.Command;
import org.jboss.aesh.console.command.CommandResult;
import org.jboss.aesh.console.command.invocation.CommandInvocation;
import org.jboss.aesh.console.command.registry.AeshCommandRegistryBuilder;
@stalep
stalep / TestParams
Created July 15, 2015 13:06
how to parse command line arguments
@CommandDefinition(name = "testparams", description = "")
public class TestParams implements Command {
@Option(shortName = 'f', description = "set the foo value")
private String foo;
@Option(shortName = 'b', required = true)
private String bar;
import org.jboss.aesh.console.AeshConsoleCallback;
import org.jboss.aesh.console.Console;
import org.jboss.aesh.console.ConsoleCallback;
import org.jboss.aesh.console.ConsoleOperation;
import org.jboss.aesh.console.Prompt;
import org.jboss.aesh.console.settings.SettingsBuilder;
public class ConsoleExample {
public static void main(String... args) {
import org.jboss.aesh.cl.Arguments;
import org.jboss.aesh.cl.CommandDefinition;
import org.jboss.aesh.console.AeshConsole;
import org.jboss.aesh.console.AeshConsoleBuilder;
import org.jboss.aesh.console.Prompt;
import org.jboss.aesh.console.command.Command;
import org.jboss.aesh.console.command.CommandResult;
import org.jboss.aesh.console.command.invocation.CommandInvocation;
import org.jboss.aesh.console.command.registry.AeshCommandRegistryBuilder;
import org.jboss.aesh.console.command.registry.CommandRegistry;
@stalep
stalep / gist:8422820
Created January 14, 2014 18:07
run æsh from a script
$ cat aeshtest.sh
#!/bin/bash
java -cp . AeshExample <<EOFDEL
login
admin
admin!234
ls
exit
@stalep
stalep / hibernate_bytecode
Created October 22, 2013 13:01
reduce the number of reflection calls from EntityTuplizer in hibernate
public interface HibernateValueMapper {
void $hibernate_setValue(Object value, String fieldName);
}
bytecode impl in entities:
...
public void $hibernate_setValue(Object value, String fieldName) {
if(fieldName == "name")
name = (String) value;
else if(fieldName == "address";
[general]
accounts = work
maxsyncaccounts = 1
maxconnections = 1
ui = Noninteractive.Basic
#ui = Noninteractive.quiet
# -------------------- Work details. --------------------
[Account work]
localrepository = work-Local
@stalep
stalep / msmtprc
Created September 26, 2013 08:44
# Set default values for all following accounts.
defaults
#tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
# redhat
account redhat
host smtp.corp.redhat.com
from spederse@redhat.com
@stalep
stalep / gist:6293925
Created August 21, 2013 12:38
jboss-cli script example
#!/bin/bash
bla
bla
bla
./jboss-cli.sh -c <<EOF
bob
admin123$
batch
/system-property=bar:add(value=foo)
run-batch
@stalep
stalep / gist:6270936
Created August 19, 2013 16:17
aeshcommand thoughts
@InjectCommand
AeshCommand command
public interface Command {
void execute() throws IOException;
}
vs
public interface Command {