Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
sachin-handiekar / empty-folder.bat
Created December 17, 2015 10:42
Delete the contents of a folder in Windows
rem Stackoverflow Ref : http://stackoverflow.com/questions/1502913/how-to-delete-all-files-and-folders-in-a-folder-by-cmd-call
rem echo off
ECHO Change to C drive
cd /d C:\
ECHO Setting target directory
set targetDir=c:\logs
@sachin-handiekar
sachin-handiekar / tips_eclipse.txt
Created December 14, 2015 11:41
Starting Eclipse with a workspace
c:/Eclipse/eclipse.exe -data /path/to/workspace
@sachin-handiekar
sachin-handiekar / compile_build_jvmti.md
Last active September 19, 2018 09:45
Compiling and creating a DLL file for a simple JVMTI example

Compiling the program

gcc -c -o simpleJVMTI.o -I"%JAVA_HOME%\include" -I"%JAVA_HOME%\include\win32"  SimpleJVMTI.c

Creating a DLL file

@sachin-handiekar
sachin-handiekar / SimpleJVMTI.c
Last active November 2, 2015 11:33
A simple JVMTI example
#include <jvmti.h>
#include <stdio.h>
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
printf("I'm a native Agent....");
return JNI_OK;
}
@sachin-handiekar
sachin-handiekar / AccessLogCLI
Created September 8, 2015 14:53
Access Log CLI
/subsystem=web/virtual-server=default-host/access-log=configuration:add
/subsystem=web/virtual-server=default-host/access-log=configuration:write-attribute(name="pattern",value="%h %l %u %t \\"%r\\" %s %b %S %T")
:reload
@sachin-handiekar
sachin-handiekar / standalone.xml
Created September 8, 2015 14:49
Enabling Access log in jBoss Portal 6.1 / jBoss EAP 6
<subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" />
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost" />
<alias name="example.com" />
<access-log pattern="%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i %S %T" prefix="access_log_" />
</virtual-server>
</subsystem>
@sachin-handiekar
sachin-handiekar / SampleConditionTest.java
Created September 4, 2015 14:47
A jUnit Test based on condition
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
public class SampleConditionTest {
@Before
public void beforeEveryMethod() {
Assume.assumeTrue(conditionToTest());
}
@sachin-handiekar
sachin-handiekar / jboss-cli-cookbook.md
Created August 26, 2015 09:44
jBoss CLI Cookbook

jBoss CLI Cookbook

  • Datasource
    • List all the datasources
      • standalone

        ls /subsystem=datasources/data-source

      • domain

  • Logging
@sachin-handiekar
sachin-handiekar / gist:ee015968ed2ae1f5f609
Last active October 9, 2018 01:27
Changing log level in jBoss EAP 6 without restarting the server
  1. Go to $JBOSS_HOME/bin

  2. Run the following command -

     ./jboss-cli.sh --connect controller=localhost:9999
    

Note : If you're using a port offset, the management console port can be calculated as,

port = managementNativeSocket (9999) + port offSet
<resource-root path="portal-request-handler.jar">