Skip to content

Instantly share code, notes, and snippets.

View luszczynski's full-sized avatar

Gustavo Luszczynski luszczynski

  • Red Hat
  • Brazil
View GitHub Profile
@luszczynski
luszczynski / persistence-hibernate-properties.xml
Created October 28, 2014 19:00
persistence.xml with jpa statistics
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_coments" value="true" />
<property name="hibernate.generate_statistics" value="true" />
<property name="hibernate.cache.infinispan.statistics" value="true" />
<property name="hibernate.cache.use_structured_entries" value="true" />
@luszczynski
luszczynski / for-split-string.sh
Created November 4, 2014 15:21
For - split string
# Change IFS according your needs
IFS=':' read -a array <<< "$string"
# Without index
for element in "${array[@]}"
do
echo "$element"
done
# With index
@luszczynski
luszczynski / EJBJNDI.java
Last active August 29, 2015 14:09
EJB JNDI View
private Map<Class<?>, String> getEJBLookups() throws NamingException, ClassNotFoundException {
InitialContext ctx = new InitialContext();
NamingEnumeration<NameClassPair> globals;
NamingEnumeration<NameClassPair> modules;
NamingEnumeration<NameClassPair> apps;
Map<Class<?>,String> lookups = new HashMap<Class<?>,String>();
globals = ctx.list("java:global");
@luszczynski
luszczynski / appModule.java
Created November 13, 2014 19:09
Get app and module name
@Resource(lookup = "java:app/AppName")
private String appName;
@Resource(lookup = "java:module/ModuleName")
private String moduleName;
@luszczynski
luszczynski / EJBJNDIWithParameters.java
Last active August 29, 2015 14:09
EJB JNDI View with parameters
private Object getEJB(final Class<?> ejbClass) throws Exception {
try {
InitialContext ctx = new InitialContext();
NamingEnumeration<NameClassPair> globals;
NamingEnumeration<NameClassPair> modules;
NamingEnumeration<NameClassPair> apps;
NameClassPair global;
NameClassPair module;
NameClassPair app;
@luszczynski
luszczynski / ldap-rbac.cli
Last active July 29, 2017 19:31
LDAP RBAC Configuration
### Authentication ###
# Create connection to LDAP with name ldap_connection
/host=master/core-service=management/ldap-connection=ldap_connection/:add(search-credential=myPass,url=ldap://example:389,search-dn="cn=John,cn=Users,dc=mydomain,dc=com")
# Create new realm with name ldap_security_realm
/host=master/core-service=management/security-realm=ldap_security_realm:add()
# Add authentication
/host=master/core-service=management/security-realm=ldap_security_realm/authentication=ldap:add(base-dn="cn=Users,dc=mydomain,dc=com", recursive=true, username-attribute="saMAccountName", connection="ldap_connection")
@luszczynski
luszczynski / datasource-statistics.cli
Last active August 29, 2015 14:09
Datasource Statistics EAP 6
/subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(runtime=true)
or
/subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(include-runtime=true)
source: https://access.redhat.com/solutions/291093
parameter https://access.redhat.com/solutions/291093
@luszczynski
luszczynski / jvm-statistics.cli
Created December 4, 2014 17:36
JVM Statistics
/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)
/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)
@luszczynski
luszczynski / async-handler.txt
Created December 5, 2014 11:43
asynchronous handler
Async Handler
How exactly does the async logging handler work in JBoss EAP 6?
https://access.redhat.com/solutions/709443
How do I change to the AsyncAppender?
https://access.redhat.com/solutions/444033
JBoss stalls with many threads blocking in AsyncHandler
https://access.redhat.com/solutions/261093
@luszczynski
luszczynski / cpu.adoc
Created January 14, 2015 18:12
CPU, Cores, Socket

Number of physical CPUs

  • grep physical.id /proc/cpuinfo | sort -u | wc -l

Number of cores per CPU

  • grep cpu.cores /proc/cpuinfo | sort -u

Number of logical processors

  • grep processor /proc/cpuinfo | wc -l